如果返回的值为true,则加载另一个分部
load another partial if value returned is true
问题
我有一个电子邮件框,用户在其中输入他们的电子邮件,然后我打一个网络服务电话,检查我的控制器中是否存在电子邮件。如果电子邮件存在,我想让他们转移到一个名为forgetpasswordcode.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' })
});
如何从控制器加载另一个部分?
使用$location
服务
$location.path('/forgotpasswordcode')
相关文章:
- HTML外部javascript加载另一个javascript
- 正在下载文件,同时加载另一个页面
- .replaceWith 无法使用 .click 函数加载另一个值
- 如何打开弹出窗口并重新加载另一个页面
- 收到事件时加载另一个.html页面
- jQuery-检查外部页面上是否存在DIV,如果存在,则加载DIV,否则加载另一个
- 在简单模式中,取消单击时不会调用onClose事件..当我在simple-modal上加载另一个jquery对话框时
- Android WebView:在javascript中,有没有一种方法可以加载另一个javascript文件,并为堆栈
- 我的按钮中的函数不会重新加载另一个函数
- 使用隐藏字段 ID 选择器加载另一个字段中的文本
- Javascript 来加载另一个 js 文件
- 加载另一个相同页面时,使用新数据激活第一个网页
- 无法从 OpenLayers 3 站点使用 WFS 示例作为基础加载另一个 WFS
- 滑动切换时加载另一个页面
- 限制元素,当我单击更多以加载另一个元素时
- 加载和定位图像,当加载另一个图像时
- 如何使用 JS 加载另一个 html 文件
- 单击CSS框加载另一个网页.CSS 或 js
- 加载另一个页面's的HTML,并使用jQuery通过选择器对其进行解析
- 加载另一个页面's DIV,与之互动?可能的(jQuery)