0
我有一個「應用程序基礎」應用程序,我希望通過授權進行擴展。應用程序基礎和ng-token-auth集成
在服務器端有一個運行着「devise_token_auth」gem的Rails應用程序。我設法將Angular的「ng-token-auth」模塊集成到Foundation應用程序中,但是當我登錄時,ui-view
容器內沒有任何渲染。
以下是文件:
user.html
---
name: user
url: /user
abstract: true
template: '<ui-view/>'
resolve: function() {function ($auth) { return $auth.validateUser(); }};
---
dashboard.html
---
name: user.dashboard
url: /dashboard
---
<div class="grid-container">
<h2>Welcome {{user.email}}</h2>
</div>
登錄in.html app.js的
---
name: sign-in
url: /sign-in
---
<form ng-submit="submitLogin(loginForm)" role="form" ng-init="loginForm = {}">
<div class="form-group">
<label>email</label>
<input type="email" name="email" ng-model="loginForm.email" required="required" class="form-control"/>
</div>
<div class="form-group">
<label>password</label>
<input type="password" name="password" ng-model="loginForm.password" required="required" class="form-control"/>
</div>
<button type="submit" class="btn btn-primary btn-lg">Sign in</button>
</form>
部分
angular.module('myApp').run(['$rootScope', '$location', function($rootScope, $location) {
$rootScope.$on('auth:login-success', function() {
$location.path('/user/dashboard');
});
}]);
我希望有人對我有暗示。我錯過了什麼?
我覺得這裏很多人不知道。 「當我登錄時」意味着一些登錄用戶界面重定向到具體狀態。我猜這裏有一個'else',在成功登錄時應該將活動狀態設置爲'user.dashboard'?還是在其他地方定義了重定向? –