从另一个mddialog调用时没有关闭mddialog。
是html:
<some-auth>
<md-button ng-click="showSign('', $event)" flex-sm="100" flex-md="100"
flex-gt-md="auto">Sign In</md-button>
</some-auth>
在控制器中:
$scope.showSign = function(typeUrl, ev) {
$mdDialog.hide().then(function(){
var templateUrl = 'login.html';
if (typeUrl.indexOf('signup') > -1) {
templateUrl = 'register.html';
} else if (typeUrl.indexOf('resetpasswd') > -1) {
templateUrl = 'resetpasswd.html';
}
$mdDialog.show({
controller: DialogController,
templateUrl: templateUrl,
parent: angular.element(document.body),
targetEvent: ev,
scope: $scope,
preserveScope: true
clickOutsideToClose:true
});
});
};
function DialogController($scope, $mdDialog) {
$scope.hide = function() {
$mdDialog.hide();
};
$scope.cancel = function() {
$mdDialog.cancel();
};
$scope.answer = function(answer) {
$mdDialog.hide(answer);
};
}
&#34; dialog_0&#34;显示/隐藏,但&#34; dialog_1&#34; (来自&#34; dialog_0&#34;)不会关闭任何。
在resetpasswd.html中有些像:
<md-dialog aria-label="Resetpasswd" ng-cloak>
<form name="resetForm" ng-controller="ResetController" ng-submit="reset()">
<md-toolbar>
<div class="md-toolbar-tools">
<h2>Reset Password</h2>
<md-button type="button" class="md-icon-button" ng-click="cancel()">
<md-icon md-font-library="material-icons" aria-label="Close dialog">close</md-icon>
</md-button>
</div>
</md-toolbar>
<md-dialog-content style="max-width:800px;max-height:810px; ">
<div class="md-dialog-content">
...
</div>
<div class="md-actions" layout="row">
<div class="modal-footer">
<md-button type="submit">Reset Password</md-button>
<md-button type="button" ng-click="showSign('', $event)" flex-sm="100" flex-md="100" flex-gt-md="auto">Login
</md-button>
</div>
</div>
</md-dialog-content>
</form>
</md-dialog>
Login.html看起来类似
答案 0 :(得分:0)
尝试选项
skipHide:true
$mdDialog.show({
skipHide: true,
controller: DialogController,
templateUrl: templateUrl,
parent: angular.element(document.body),
targetEvent: ev,
scope: $scope,
preserveScope: true
clickOutsideToClose:true
});