@rarejai wrote:
Hi all. Sorry for a newbie question but I have tried to google but cannot find a solution. I am trying to use 'onEnter' to check if the user has login, and then change to state to login page. The state has been changed correctly and it enter my login page. However, it throw some strange error on firebug. Here is my code:
.state('tabs.account', { url : '/tabs/account', views : { 'tab-account' : { templateUrl : 'templates/account.html', controller : 'accountCtrl' } }, onEnter : function($state, $localStorage) { var user = $localStorage.get('user'); if (user == null || !user.logged) { $state.go('member'); } } })
state for 'member':
.state('member', { url : '/member', templateUrl : 'templates/member.html', controller : 'memberCtrl' })
and what I get from firebug:
Error: $state.$current.locals is null updateView@http://localhost:8100/lib/ionic/js/ionic.bundle.js:57566:15 .compile/</<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:57557:11 $RootScopeProvider/this.$get</Scope.prototype.$broadcast@http://localhost:8100/lib/ionic/js/ionic.bundle.js:24997:15 load@http://localhost:8100/lib/ionic/js/ionic.bundle.js:45181:11 resolveState/</injectables.$template<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:45081:18 invoke@http://localhost:8100/lib/ionic/js/ionic.bundle.js:13282:14 proceed@http://localhost:8100/lib/ionic/js/ionic.bundle.js:42097:32 invoke@http://localhost:8100/lib/ionic/js/ionic.bundle.js:42093:26 $Resolve/this.study/<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:42072:14 $Resolve/this.resolve@http://localhost:8100/lib/ionic/js/ionic.bundle.js:42176:12 resolveState/<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:45084:23 forEach@http://localhost:8100/lib/ionic/js/ionic.bundle.js:9182:11 resolveState@http://localhost:8100/lib/ionic/js/ionic.bundle.js:45078:7 transitionTo@http://localhost:8100/lib/ionic/js/ionic.bundle.js:44780:20 go@http://localhost:8100/lib/ionic/js/ionic.bundle.js:44630:14 .onEnter@http://localhost:8100/js/app.js:152:11 invoke@http://localhost:8100/lib/ionic/js/ionic.bundle.js:13282:14 transitionTo/$state.transition<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:44806:13 processQueue@http://localhost:8100/lib/ionic/js/ionic.bundle.js:23399:28 scheduleProcessQueue/<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:23415:27 $RootScopeProvider/this.$get</Scope.prototype.$eval@http://localhost:8100/lib/ionic/js/ionic.bundle.js:24678:16 $RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost:8100/lib/ionic/js/ionic.bundle.js:24489:15 $RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost:8100/lib/ionic/js/ionic.bundle.js:24783:13 .link/<@http://localhost:8100/lib/ionic/js/ionic.bundle.js:59028:11 createEventHandler/eventHandler@http://localhost:8100/lib/ionic/js/ionic.bundle.js:12103:9 triggerMouseEvent@http://localhost:8100/lib/ionic/js/ionic.bundle.js:2870:3 tapClick@http://localhost:8100/lib/ionic/js/ionic.bundle.js:2859:3 tapMouseUp@http://localhost:8100/lib/ionic/js/ionic.bundle.js:2932:5
Posts: 1
Participants: 1