admin管理员组文章数量:1332403
Does $uibModalInstance have any properties like .ready or .opened? I am trying to change the CSS class of elements within a UI Bootstrap modal based on the data passed to it. I need a way to trigger the function once the modal is loaded. I know $uibModal has properties like .opened, .close, and .rendered, but this triggers in the controller that created the modal, not within the modal controller itself. And since all the data is within the modal controller, I can't access it from the outside controller.
Any suggestions?
Does $uibModalInstance have any properties like .ready or .opened? I am trying to change the CSS class of elements within a UI Bootstrap modal based on the data passed to it. I need a way to trigger the function once the modal is loaded. I know $uibModal has properties like .opened, .close, and .rendered, but this triggers in the controller that created the modal, not within the modal controller itself. And since all the data is within the modal controller, I can't access it from the outside controller.
Any suggestions?
Share Improve this question asked Apr 7, 2016 at 21:41 MichaelMichael 3184 silver badges23 bronze badges1 Answer
Reset to default 8You can access the $uibModalInstance in the modal controller and do something like so:
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');
});
});
本文标签: javascriptDoes uibModalInstance have any properties like ready or openedStack Overflow
版权声明:本文标题:javascript - Does $uibModalInstance have any properties like .ready or .opened? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742231455a2437292.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论