likeastore / ngDialog

Modals and popups provider for Angular.js applications
http://likeastore.github.io/ngDialog
3.14k stars 692 forks source link

FEATURE: Add "top" option #499

Open giacomomasseron opened 8 years ago

giacomomasseron commented 8 years ago

Hi, since I had problem with using this module inside a facebook canvas app, I added the "top" option to the module on my own. I wanna ask you if you can do it on the repository, cause I think it can be a good feature in some environments.

faceleg commented 8 years ago

I don't quite understand the implications, but I'm absolutely happy to look at a PR (or read more of an explanation regarding what it does)

giacomomasseron commented 8 years ago

If you use this dialog in a facebook canvas app, you need a code like this:

FB.Canvas.getPageInfo(
    function(info) {
        ngDialog.open({
            template: response.data.html,
            plain: true,
            className: 'ngdialog-theme-default',
            top: info.scrollTop + 'px',
            scope: $scope });
    }
);

otherwise your dialog will be shown on the top of the page even if you scrolled the page down.

faceleg commented 8 years ago

I'm now open to a PR for this, looks like a useful feature.

Please include a unit test to prove it works?