Closed lrvick closed 10 years ago
I'm very sorry for the late response.
This is probably because the user hasn't been loaded yet, you should run the code in the login event, like this:
$rootScope.$on('user.login', function() {
if (user.hasPermission('permission1')){
$location.path('/path1')
}
if (user.hasPermission('permission2')){
$location.path('/path2')
}
});
Let me know how that works out!
user.hasPermission() does not seem to be usable from within controllers.
For instance:
user.hasPermission('permission1') shows false so the route never happens, but it is actually true in userapp, and in the view shows to be true.