我希望能够在模式外部单击以关闭它,但无法找到阻止clickOutsideToClose事件传播的方法。到目前为止,我已经尝试过OnRemoving,它在关闭模态时会被调用,但event.stopImmediatePropagation()不会停止模态的关闭。
$scope.openModal = function(){
$mdDialog.show({
templateUrl: 'app/summary/example.modal.html',
parent: angular.element(document.body),
clickOutsideToClose: true,
fullScreen: true,
locals:{
step: {name: 'openingPage'}
},
controller : function($scope, step){
$scope.step = step;
},
onRemoving: function(event, removePromise){
console.log('OnRemoving called');
event.stopImmediatePropagation();
}
}).then(function(){
console.log('inside success function of show then');
}, function(){
ExampleFactory.clearAll();
});
};
我正在使用范围变量步骤在模式的页面之间移动,所以我希望能够在clickOutsideToClose事件发生时为确认页面设置。实际上关闭模态会在确认页面上发生,带有是/否按钮。
<md-dialog class="exampleModal">
<md-dialog-content>
<div ng-switch="step.name">
<opening-page ng-switch-when="openingPage" step="step"></opening-page>
<confirmation-page ng-switch-when="confirm" step="step"></confirmation-page>
</div>
</md-dialog-content>
</md-dialog>