javascript - 加载时的 Bootstrap-angular-ui 模式

标签 javascript angularjs twitter-bootstrap

我正在使用 bootstrap-angular-ui-modal对于我正在处理的网站。我用来打开模态的代码

$modal.open(
    {
        templateUrl: '/home/template',
        controller: myCtrl,
        resolve: {
            data: function () {
                return data;
            }
        }
    });

一切正常。但是我需要找到一种方法来在加载模态后执行一些代码。我尝试了不同的东西,但无法使它们起作用。我尝试过的一些事情

在我做的模板中

<script>
    document.onload = function () {
        console.log('opened');
    };
</script>

我还发现名为 openned 的 Angular 模态对象有一个 promise 。我试过

modalInstance.opened.then(function(){console.log('hello')});

也不行。我在这里需要一些帮助。

最佳答案

这绝对不是一个好的解决方案,但至少对我有用。我只是在执行所需功能之前添加了一个超时,

modalInstance.opened.then(
    $timeout(function() {
            console.log('hello');
        }, delay));

关于javascript - 加载时的 Bootstrap-angular-ui 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19657323/

相关文章:

css - 事件横幅应用程序链接和 Bootstrap

javascript - focusout jquery 中的无限循环,仅在 Chrome 中

javascript - 在 Internet Explorer 中,当父元素的兄弟元素被隐藏时,子元素不会在页面上移动

javascript - DIV 类错误

javascript - 在 AngularJS 中的指令之间更新数据/状态

css - 如何自动调整 Bootstrap 导航栏中的下拉框不超过页面宽度?

javascript - JSON : Convert Json For Chart CanvasJS

javascript - 如何使用 AWS 设置 AngularJS 应用程序?

angularjs - Angular ,使用资源时无法正确生成内容类型

jquery - Bootstrap Mobile 菜单在菜单打开和关闭时切换类