我想在我的登录页面中使用$ stateProvider处理页面refesh当我点击链接时忘记了pwd链接忘记了pwd页面根据路由代码出现,但现在我遇到了一个问题,当我刷新我的忘记pwd页面我的页面被重定向到登录页面,请告诉我如何解决这个问题?
这是我的login.html页面,忘记了密码链接:
<div class="input-element-row">
<div class="forgot-pass"><a ui-sref="forgot">Forgot password?</a></div>
</div>
这是我的router.js包含路由代码:
angular.module("nk.login", [
'ngRoute',
'ngAnimate'
]).
config(['$stateProvider',function($stateProvider){
$stateProvider
.state('app.login', {
url: '/login',
views: {
"content": {
templateUrl: 'src/login/templates/login.html',
controller: 'loginController'
}
}
})
.state('app.forgotPassword', {
url: '/forgot',
views: {
"content": {
templateUrl: 'src/login/templates/forgotPassword.html',
controller: 'forgotPasswordController'
}
}
})
}]);
这是我的forgotpwd.html页面:
<div class="inputs-container">
<form name="forgotPassword" novalidate>
<div class="input-element-row">
<div class="rgt-input-box fl"><span class="center-icon action-icon"></span><input type="text"
ng-model="Nuser.center_code" placeholder="Center Code" name="CenterCode" value=""
ng-pattern = "/^[0-9a-zA-Z]*$/" maxlength="5" required ng-disabled="isDisable"/></div>
<div class="cb">
</div>
</div>
<div class="input-element-row">
<div class="rgt-input-box fl"><span class="user-icon action-icon"></span><input type="text"
placeholder="User ID" ng-model="Nuser.login_id" name="UserID" value=""
ng-pattern = "/^[0-9a-zA-Z]*$/" maxlength="10" required ng-disabled="isDisable"/></div>
<div class="cb"></div>
</div>
<div class="input-element-row">
<button type="button" name="send" ng-click="send(userLogin)">Send</button>
</div>
</form>
</div>
答案 0 :(得分:-1)
也许您的路由可以简化如下
angular.module("nk.login", [
'ngRoute',
'ngAnimate'
]).
config(['$stateProvider',function($stateProvider){
$stateProvider
.state('app.login', {
url: '/login',
templateUrl: 'src/login/templates/login.html',
controller: 'loginController'
})
.state('app.forgotPassword', {
url: '/forgot',
templateUrl: 'src/login/templates/forgotPassword.html',
controller: 'forgotPasswordController'
})
}]);
views / content属性是否有任何特定原因?