我有一个电子邮箱,用户输入他们的电子邮件,然后我进行Web服务调用以检查控制器中是否存在电子邮件。如果电子邮件存在,我希望他们转移到名为 forgotpasswordcode.html 的部分内容。
以下是用户输入电子邮件的页面:
<div id="forgotpasswordWrapper" ng-controller="forgotPasswordController">
<div class="container-fluid">
<div class="row">
<form name="forgotpasswordForm" autocomplete="off" class="text-center col-xs-12 col-sm-6 col-sm-offset-3 col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">
<div class="col-lg-12">
<img src="images/logo.png" />
</div>
<div class="col-lg-12">
<input id="email" name="email" type="email" required placeholder="Email" ng-model="email">
</div>
<div class="col-lg-12">
<button type="submit" ng-click="forgotpasswordForm.$valid && ResetPassword()">
<span>Reset Password</span>
</button>
</div>
</form>
</div>
</div>
然后按钮指向控制器:
app.controller('forgotPasswordController', function ($scope, forgotPasswordService) {
$scope.ResetPassword = function () {
//REDIRECT TO PARTIAL forgotpasswordcode.html
};
});
我的路由引擎设置如下:
app.config(function ($routeProvider) {
$routeProvider
.when('/', { templateUrl: 'partials/login.html', controller: 'loginController'})
.when('/forgotpassword', { templateUrl: 'partials/forgotpassword.html', controller: 'forgotPasswordController' })
.when('/forgotpasswordcode', { templateUrl: 'partials/forgotpasswordcode.html', controller: 'forgotPasswordCodeController' })
});
如何从控制器加载另一部分?