Angular ui bootstrap 从覆盖关闭时模态调用关闭函数
Angular ui bootstrap modal call close function when closing from overlay
当用户从叠加层关闭模式时,我如何 运行 执行相同的功能?
例如现在我有关闭按钮这个功能:
close() {
this.$modalInstance.close();
this.AlertService.reset();
}
但是当用户从叠加层关闭模式时,此功能不会运行。
看看angular bootstrap documentation。
$modal.open returns一个模态实例,一个参数是'result'。这是在关闭模式时触发的承诺。
var $modalInstance = $modal.open({ ... });
$modalInstance.result.then(function (selectedItem) {
$scope.selected = selectedItem;
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
此外,请注意关闭前广播的 modal.closing 事件,可用于防止关闭 'event.preventDefault'。
当用户从叠加层关闭模式时,我如何 运行 执行相同的功能?
例如现在我有关闭按钮这个功能:
close() {
this.$modalInstance.close();
this.AlertService.reset();
}
但是当用户从叠加层关闭模式时,此功能不会运行。
看看angular bootstrap documentation。
$modal.open returns一个模态实例,一个参数是'result'。这是在关闭模式时触发的承诺。
var $modalInstance = $modal.open({ ... });
$modalInstance.result.then(function (selectedItem) {
$scope.selected = selectedItem;
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
此外,请注意关闭前广播的 modal.closing 事件,可用于防止关闭 'event.preventDefault'。