模态加载angularjs ui bootstrap后的调用函数 [英] Call function after modal loads angularjs ui bootstrap
问题描述
我正在使用 Angularjs UI bootstrap
在我的项目中渲染模态窗口.但在某些情况下,我想在模态加载后调用一个函数.我试过 $timeout
和 $viewContentLoaded
但没有用.任何人都可以帮我解决这个问题.
I am using Angularjs UI bootstrap
to render Modal windows in my project. But In some situation I want to call a function after the modal loads. I have tried with $timeout
and $viewContentLoaded
but no use. can any one help me to resolve this issue.
谢谢大家.
推荐答案
我查阅了 angular ui bootstrap 的文档,终于找到了解决方案.
I go through the documentation of angular ui bootstrap and finally I found the solution.
open
方法返回一个 modal 实例
,一个具有 opened
属性的对象:
The open
method returns a modal instance
, an object with the opened
propertie:
opened
- 一个 promise
,在下载内容模板并解析所有变量后打开模态时解析
opened
- a promise
that is resolved when a modal gets opened after downloading content's template and resolving all variables
模型打开后调用函数.
$modalInstance.opened.then(function(){
alert('hi');
});
这篇关于模态加载angularjs ui bootstrap后的调用函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!