( function() { angular.module('shared') /** * laz-lightwindow directive provides a popup iframe * * Parameters: * * @href Url to be displayed. Can be specified as href parameter or href option of the laz-lightwindow. Option setting takes precedence. * @height Height of the laz-lightwindow. default 1000. * @width Width of the laz-lightwindow. default: 900. * * Examples: * * * */ .directive('lazLightwindow', ['LazLightwindowService', function(LazLightwindowService) { return { restrict: 'A', link: function (scope, element, attrs) { element.on('click', function (event) { event.preventDefault(); var userOptions = scope.$eval(attrs.lazLightwindow) || {}; var options = angular.extend({ enabled: !attrs.hasOwnProperty('requiresLoginPath'), href: attrs.href }, userOptions); if(options.enabled){ showContent(options); } }); function showContent(options){ LazLightwindowService.show(options) .then(function (modal) { scope.$on('laz-lightwindow:close', function () { modal.controller.close(); }); }); } } }; }]); })();