I've implemented the modal directive, and set the $modal.open
option backdrop to false
. However, now I can trigger multiple modals to open. Is there a way to prevent the trigger button from firing once one modal is open?
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());
});
};
};
Thanks
Use a boolean flag to avoid it:
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;
});
};
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With