你可以用不同的方式做到这一点......
这是您的 HTML 登录模板。
<form name="loginForm" id="login" ng-controller="loginCtrl as vm">
<h3>Login</h3>
<p> Login Form goes here...
</p>
<button type="button" ng-disabled="loginForm.$invalid" ng-click="confirm()" class="btn btn-success pull-right">Next</button>
<button type="button" ng-click="closeThisDialog('login')" class="btn btn-success pull-left">Cancel</button>
<br> </form>
和.. 帐户 HTML 模板...
<form name="accountForm" id="account" ng-controller="loginCtrl as vm">
<h3>Login</h3>
<p>
Account Form goes here...
</p>
<button type="button" ng-disabled="accountForm.$invalid" ng-click="confirm()" class="btn btn-success pull-right">Update</button>
<button type="button" ng-click="closeThisDialog('account')" class="btn btn-success pull-left">Cancel</button>
<br>
</form>
这是角度脚本..
(function () {
"use strict";
angular
.module("dialogDemo")
.controller("loginCtrl", ["ngDialog", loginCtrl]);
function loginCtrl(ngDialog) {
var vm = this;
vm.login = function () {
ngDialog.openConfirm({
template: 'login.html',
className: 'ngdialog-theme-default',
showClose: false
}).then(function (value) {
//Here you could close the current dialog and open a new dialog
ngDialog.close('login'); // Give your Diloag element Id
ngDialog.openConfirm({
template: 'updateAccount.html',
className: 'ngdialog-theme-default',
showClose: false
}).then(function (value) {
console.log('Modal promise resolved. Value: ', value);
}, function (reason) {
console.log('Modal promise rejected. Reason: ', reason);
});
console.log('Modal promise resolved. Value: ', value);
}, function (reason) {
console.log('Modal promise rejected. Reason: ', reason);
});
};
};
}());