模态加载angularjs ui bootstrap后的调用函数 [英] Call function after modal loads angularjs ui bootstrap

查看:26
本文介绍了模态加载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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆