AngularJS Fancybox Popup

前端 未结 3 617
挽巷
挽巷 2020-12-15 13:12

I have started an angularjs project and I would like to implement fancybox.

For this, I have included the jQuery and fancybox plugins to the solution. I am attemptin

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-15 13:52

    I have created a directive for fancybox

    app.directive('fancybox',function($compile, $timeout){
        return {
            link: function($scope, element, attrs) {
                element.fancybox({
                    hideOnOverlayClick:false,
                    hideOnContentClick:false,
                    enableEscapeButton:false,
                    showNavArrows:false,
                    onComplete: function(){
                        $timeout(function(){
                            $compile($("#fancybox-content"))($scope);
                            $scope.$apply();
                            $.fancybox.resize();
                        })
                    }
                });
            }
        }
    });
    

提交回复
热议问题