我在app.run方法中有以下代码。状态正在更改为登录但闪烁。如何避免这种闪烁?
$rootScope.$on('$stateChangeStart', function (event, toState, toStateParams) {
if (toState.name != 'login') {
$rootScope.toState = toState;
$rootScope.toStateParams = toStateParams;
//Checking whether the user is logged, if not redirect to login page.
if (!principal.isIdentityResolved()) {
$state.go('login');
event.preventDefault();
}
}
});