私は$ionicModal
と少し問題があります。私はモーダルを開くたびに、空のルートを強制して$urlRouterProvider.otherwise('/login');
を発生させます。私は$urlRouterProvider
を私の設定から取り除くとうまくいきますが、私のアプリは空白の画面になるだけです。誰もがこの問題の原因を知っていますか?私は私のFeedController
内部はかなり標準的にイオンのモーダルを呼んでいる:
$ionicModal.fromTemplateUrl('templates/views/view.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modal = modal;
});
$scope.modal.show().then(function() {
// Blah
});
私の設定は次のようになります。
$stateProvider
.state('login', {
url: '/login',
templateUrl: 'templates/login.html',
controller: 'LoginController',
resolve: {
'currentAuth': function(Auth) {
return Auth.checkAuth().$waitForAuth();
},
'clearCache': function($ionicHistory) {
return $ionicHistory.clearCache();
}
}
})
.state('app', {
url: '/app',
abstract: true,
templateUrl: 'templates/main.html',
controller: 'SideMenuController',
resolve: {
'currentAuth': function(Auth) {
return Auth.checkAuth().$waitForAuth();
}
}
})
.state('app.feed', {
url: '/feed',
views: {
'viewContent': {
templateUrl: 'templates/views/feed.html',
controller: 'FeedController',
resolve: {
'currentAuth': function(Auth) {
return Auth.checkAuth().$requireAuth();
},
'clearCache': function($ionicHistory) {
return $ionicHistory.clearCache();
}
}
}
});
$urlRouterProvider.otherwise('/login');
});
私も状態がロードされる前に、私はAngularFire認証を確認するために解決しています言及する必要があります。イムは、これはログイン画面にユーザーをリダイレクトし、$stateChangeError
がありますかどうかを確認するために$rootScope
に聞いて、これは、したがって$urlRouterProvider
行削除、問題ではないようです。
$rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error) {
if (error === 'AUTH_REQUIRED') {
$state.go('login');
}
});
私もだがFeedController
とLoginController
のキャッシュをクリアします。 $ ionicModalsでこの問題を経験した人はいますか?もしあなたが手伝ってくれたら教えてください。親切にありがとう。
ありがとうございました!あなたはちょうど私の頭を壁に置くことから私を救った。 :) – WonderGrub