1
從另一個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);
};
}
「dialog_0」 顯示/隱藏,但 「dialog_1」(這是從 「dialog_0」 稱呼)不收任何。
<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類似於