1
我试图将所有未授权流量路由到登录页面,并且正在使用angularfire进行身份验证。 Here's all the relevant code.我知道大部分都是坏的,但我想首先得到它。有问题的代码是:
App.js
app.run(['$rootScope', '$location', 'AuthenticatorService', function ($rootScope, $location, AuthenticatorService) {
$rootScope.$on('$routeChangeStart', function (event) {
if (AuthenticatorService.isLoggedIn) {
console.log('DENY');
event.preventDefault();
$location.path('/login');
}
else {
console.log('ALLOW');
$location.path('/home');
}
});
}]);