Hello guys I have the following situation:
I have parent tab.login and want onEnter to check if the user is logged so i could redirect him to a child state using $state.go, but i got the error :
Cannot read property ‘@’ of null.
Any idea why is this happening?
Here is my code.
.state('tab.login', {
url: '/login',
onEnter: function(UserData,$localstorage,$state){
loginData=$localstorage.getObject('login_json');
if (loginData && (loginData.id!=null) ) {
$state.go('tab.profiledata');
} else {
return ;
}
},
views: {
'tab-login': {
templateUrl: 'templates/tab-login.html',
controller: 'LoginCtrl'
}
}
})
.state('tab.profiledata', {
url: '/profiledata',
cache: true,
storage: 'localStorage',
views: {
'tab-login': {
templateUrl: 'templates/tab-profile.html',
controller: 'PersonalProfileCtrl'
}
}
});