在ngDialog的示例中,它们显示了具有多个“窗格”的模式,您可以在其中滚动:http://likeastore.github.io/ngDialog/。
我通读了ngDialog指南,却找不到简单的方法来完成此操作-任何想法都将不胜感激。我想要的只是窗格上的一个按钮,您可以单击该按钮以转到模式中的下一个窗格。 (就像示例一样-但没有动画)。
谢谢!
//Here is my Controller instantiation of the ngDialog
$scope.clickToOpen = function(testy) {
ngDialog.open({
template: 'createNewTemplate',
scope: $scope
});
};
这是我的HTML模板:
<form ng-submit="login()">
<h1>Login</h1>
<input type="text" ng-model="loginUser.email" placeholder="Email">
<input type="text" ng-model="loginUser.password" placeholder="Password">
<button ng-click="goToNextPane()"> Login </button>
</form>
最佳答案
您可以用不同的方式来做...
这是您的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);
});
};
};
}());
关于javascript - ngDialog Modal for Angular中的多个 Pane ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34077768/