Issue
I have a email box where a user enters their email which to then I make a web service call to check the email exists inside my controller. I want to them move to a partial called forgotpasswordcode.html if the email exists.
我有一个电子邮箱,用户输入他们的电子邮件,然后我进行Web服务调用以检查控制器中是否存在电子邮件。如果电子邮件存在,我希望他们转移到名为forgotpasswordcode.html的部分。
Code
Here is the page where the user enters their email:
这是用户输入电子邮件的页面:
<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>
The button then points to the controller here:
然后按钮指向控制器:
app.controller('forgotPasswordController', function ($scope, forgotPasswordService) {
$scope.ResetPassword = function () {
//REDIRECT TO PARTIAL forgotpasswordcode.html
};
});
I do have a routing engine set up like below:
我确实有一个如下设置的路由引擎:
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' })
});
How can I load another partial from my controller?
如何从控制器加载另一个部分?