2016-12-02 5 views
0

私はng-token-authを使用するIonicアプリを持っています。これは、異なる認証apiを持つ2組のユーザーに対して2 ng-token-auth configsを使用します。Ionic AngularJSはすでに認証されているとリダイレクトします

app.js

$stateProvider 

    .state('home', { 
     url: '/home', 
     templateUrl: 'templates/home/home.html', 
     controller: 'HomeCtrl' 
    }) 
    .state('employee', { 
     url: "/employee", 
     templateUrl: "templates/employee.html", 
     controller: 'EmployeeCtrl' 
    }) 
    .state('employer', { 
     url: "/employer", 
     templateUrl: "templates/employer.html", 
     controller: 'EmployerCtrl' 
    }) 

    $urlRouterProvider.otherwise('/home'); 

HomeCtrl

$scope.$on('$ionicView.beforeEnter', function(){}); 

私は現在$ ionicView.beforeEnterのチェックイン認証を置くが、それは、ホーム画面が点滅して、正しいページにリダイレクトします。これを置く場所がありますか? $ urlRouterProvider.otherwiseのための私のデフォルトの状態になり感謝

答えて

0

Uが状態プロバイダー..

編集=>雇用状態からホーム状態に「解決」を使用することができ

.state('home', { 
    url: "/home", 
    templateUrl: "templates/home/home.html", 
    controller: 'HomeCtrl', 
    resolve: { 
      //check if user is remembered & redirect to next state 
    } 
}) 
+0

( '/ home')従業員と雇用主の両方がいるからですか? –

+0

私はあなたのアプリが正しいと理解している場合は、あなたが従業員や雇用者の状態にリダイレクトする必要があるかどうかを解決することができる家庭の状態を最初にロードする必要があります。 –

関連する問題