lap*_*ppy 8 angularjs angular-ui-bootstrap
我已经实现了模态指令,并将$modal.open
选项背景设置为false
.但是,现在我可以触发多个模态打开.有一种方法可以防止触发按钮在一个模态打开后触发吗?
var accountSummaryCtrl = function ($scope, $modal, $log) {
$scope.open = function () {
var modalInstance = $modal.open({
templateUrl: '/Apps/generic/modal/Templates/AccountSummary.html',
controller: ModalInstanceCtrl,
backdrop: false
});
modalInstance.result.then(function (selectedItem) {
$scope.selected = selectedItem;
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
};
};
Run Code Online (Sandbox Code Playgroud)
谢谢
J. *_*uni 13
使用布尔标志来避免它:
var accountSummaryCtrl = function ($scope, $modal, $log) {
var opened = false;
$scope.open = function () {
if (opened) return;
var modalInstance = $modal.open({
templateUrl: '/Apps/generic/modal/Templates/AccountSummary.html',
controller: ModalInstanceCtrl,
backdrop: false
});
opened = true;
modalInstance.result.then(function (selectedItem) {
$scope.selected = selectedItem;
opened = false;
}, function () {
$log.info('Modal dismissed at: ' + new Date());
opened = false;
});
};
};
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
11308 次 |
最近记录: |