I'm using angular-permission 5.3.2. Here is my app.run.js
(function() {
'use strict';
angular
.module('myApp')
.run(run);
/** @ngInject */
function run(PermRoleStore, PermPermissionStore, $auth)
{
PermRoleStore
.defineRole('user', function (stateParams) {
if($auth.isAuthenticated()) {
return true; // Is loggedin
}
return false;
});
}})();
And here is how I check for permission for route view2
.state('view2', {
url: '/view2',
templateUrl: 'view2/view2.html',
controller: 'View2Ctrl as vm',
data: {
permissions: {
only: 'user',
redirectTo: 'view1'
}
},
});
The problem is that I'm not redirected to view1, even if I'm not logged in. Does anyone know where's the problem?