【发布时间】:2016-12-30 13:45:04
【问题描述】:
当用户点击最终确认模态弹窗的关闭按钮时,我想关闭所有模态弹窗。
但是打开的模态窗口确实属于不同的控制器。这是sn-p:
function getQuickCasePopup($scope, $uibModal, $rootScope) {
var templateUrl = BasePath + 'App/Transaction/Views/common/QuickCaseSearch.tpl.html';
var controller = 'QuickCaseSearchCtrl';
OpenModal($scope, $uibModal, null, templateUrl, controller, null, null, '', $rootScope);
}
function getAddCasePopup($scope, $uibModal, $rootScope) {
var templateUrl = BasePath + 'App/Transaction/Views/common/CreateCase.tpl.html';
var controller = 'AddCaseCtrl';
OpenModal($scope, $uibModal, null, templateUrl, controller, null, null, '', $rootScope);
}
function getAdvanceCasePopup($scope, $uibModal, $rootScope) {
var templateUrl = BasePath + 'App/Transaction/Views/common/AdvanceCaseSearch.tpl.html';
var controller = 'AdvanceCaseCtrl';
OpenModal($scope, $uibModal, null, templateUrl, controller,null, null, 'lg', $rootScope);
}
function OpenModal($scope, $uibModal, $stateParams, templ, ctrl, grid, row, size, $rootScope) {
var CssClass = '';
if (size === 'lg') {
CssClass = 'app-modal-window';
}
var ModalInstance = ModalInstance || $uibModal.open({
animation: $scope.animationsEnabled,
templateUrl: templ,
controller: ctrl, // Logic in instantiated controller
windowClass: CssClass
});
确认弹窗代码如下:
$("#iConfirmationModal").modal();
$("#iConfirmationModal").on('hidden.bs.modal', function () {
//$(".app-modal-window").dialog("close"); //Did not work
$state.go('transaction.search', {});
});
所以我想关闭所有的模态弹窗然后重定向。我能达到同样的效果吗?
【问题讨论】:
-
这些模态是否在彼此之上打开,第二个模态是否从第一个模态中打开?
-
没有这些模态是分开的。
-
你应该创建一个工厂来在一个地方管理它们。
标签: javascript jquery angularjs twitter-bootstrap