Angularjs   发布时间:2022-04-20  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了AngularJS Fancybox Popup大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经开始了一个 angularjs项目,我想实现fancybox.

为此,我将jQuery和fancybox插件包含在解决方案中.我试图在fancybox窗口中打开下面显示代码中的模板.

视图

< a href =“”ng-click =“openPage('popups / add.html')”> ADD< / a>

调节器

app.controller('MainController',function MainController($scopE) {
        $scope.user = "Hey Welcome";

        $scope.open = function(template_path){
            $.fancybox({"href":template_path})
        }
    }
)

和popup / add.html

<div class="pop-contnr">
    <h2>ADD</h2>
    <table>
        <thead>
            <tr>
                <th align=center>{{user}}</th>
            </tr>
        </thead>
    </table>
</div>

fancybox成功打开包含模板的窗口,但尚未评估{{user}}表达式.有人可以帮忙吗?

我为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();
                    })
                }
            });
        }
    }
});

大佬总结

以上是大佬教程为你收集整理的AngularJS Fancybox Popup全部内容,希望文章能够帮你解决AngularJS Fancybox Popup所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。