【问题标题】:How to wireup an AngularStrap modal show event如何连接 Angular Strap 模态显示事件
【发布时间】:2016-04-01 19:45:29
【问题描述】:

我的模态显示很好。我试图弄清楚当模态显示时如何运行一个函数。

 var = loginModal = $modal({ placement: 'left', title: '', content: webauth, show: false });

 $scope.$on('modal.show', function () {
        console.log("SHOWN");
        debugger;
    });

    $scope.showModal = function () {

        loginModal.$promise
            .then(loginModal.show);

    };

我期待 $scope.$on('modal.show') 在显示模式时触发,但到目前为止还没有运气。

【问题讨论】:

    标签: javascript modal-dialog angular-strap


    【解决方案1】:

    试试这个:

    $scope.showModal = function() {
        myModal.$promise.then(myModal.show).then(function(){
            console.info('shown');
        });
    };
    

    【讨论】:

    • 这行得通。我现在没有预见到的问题是模式的内容是 Iframe,并且在事件触发时不会立即可用。我对此有一些想法。非常感谢您的帮助!
    • 如果有人感兴趣,我使用这篇文章连接 iframe onload 事件stackoverflow.com/questions/15882326/…: window.uploadDone=function(){ /* 可以在此处访问 $scope*/ }
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-07
    • 2015-10-31
    相关资源
    最近更新 更多