angularjs – 角度UI引导模态对话框关闭事件
发布时间:2020-12-17 07:38:29 所属栏目:安全 来源:网络整理
导读:如何检测 Angular UI Bootstrap模态对话框何时关闭? 我需要知道对话框何时关闭,所以我可以使用angular-http-auth库广播一个loginCancelled事件,以防止我的角色UI挂起,特别是通过点击背景幕关闭模态. 这适用于单击背景幕并按Esc键,如果您选择了此选项. var m
如何检测
Angular UI Bootstrap模态对话框何时关闭?
我需要知道对话框何时关闭,所以我可以使用angular-http-auth库广播一个loginCancelled事件,以防止我的角色UI挂起,特别是通过点击背景幕关闭模态.
这适用于单击背景幕并按Esc键,如果您选择了此选项.
var modalInstance = $modal.open({ templateUrl: '/app/yourtemplate.html',controller: ModalInstanceCtrl,windowClass: 'modal',keyboard: true,resolve: { yourResulst: function () { return 'foo'; } } }); var ModalInstanceCtrl = function ($scope,$modalInstance,yourResulst) { var constructor = function () { // init stuff } constructor(); $modalInstance.result.then(function () { // not called... at least for me },function () { // hit's here... clean up or do whatever }); // VVVV other $scope functions and so on... }; 更新:替代方法 我不知道为什么这样没有记录在http://angular-ui.github.io/bootstrap/ …但我觉得好多了.您现在可以使用该页面的控制器或使用控制器作为语法的特定控制器.你甚至可以使用ng-include来进行模态的内容,如果你想在html上进行分离.以下工作与控制器中没有JS需要设置/配置模态,只要您的项目/站点中包含bootstrap / bootstrapUI <div class="row"> <button class="btn btn-default" data-toggle="modal" data-target="#exampleModal">Open Example Modal</button> </div> <div class="modal fade" id="exampleModal" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">Close</button> <h2 class="modal-title" id="exampleModalLabel">Modal Example</h2> </div> <div class="modal-body" style="padding-bottom:0px;"> <h3>model markup goes here</h3> </div> </div> </div> </div> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |