加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

AngularJS Fancybox Popup

发布时间:2020-12-17 08:33:35 所属栏目:安全 来源:网络整理
导读:我已经开始了一个 angularjs项目,我想实现fancybox. 为此,我将jQuery和fancybox插件包含在解决方案中.我试图在fancybox窗口中打开下面显示的代码中的模板. 视图 a href =“”ng-click =“openPage('popups / add.html')” ADD / a 调节器 app.controller('Ma
我已经开始了一个 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();
                    })
                }
            });
        }
    }
});

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读