Mic*_*ael 4 javascript angular-ui-bootstrap angular-ui-modal
$ uibModalInstance是否有任何属性,如.ready或.opened?我试图根据传递给它的数据更改UI Bootstrap模式中的CSS类元素.加载模态后,我需要一种方法来触发函数.我知道$ uibModal具有.opened,.close和.rendered等属性,但这会在创建模态的控制器中触发,而不是在模态控制器本身内.由于所有数据都在模态控制器内,因此我无法从外部控制器访问它.
有什么建议?
您可以在模态控制器中访问$ uibModalInstance并执行以下操作:
angular.module('ui.bootstrap.demo').controller('ModalInstanceCtrl', function ($scope, $uibModalInstance, items) {
$uibModalInstance.rendered.then(function() {
alert('modal has rendered');
});
$uibModalInstance.opened.then(function() {
alert('modal has opened');
});
$uibModalInstance.closed.then(function() {
alert('modal has closed');
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3390 次 |
| 最近记录: |