Why does $state.transitionTo or $state.go does not display the new HTML partial?

后端 未结 3 1592
独厮守ぢ
独厮守ぢ 2021-01-22 09:22

Here is a piece of code destined to check user rights before each UI-router state change. Everything works fine, except the fact that when rights are OK, the transition to the n

3条回答
  •  迷失自我
    2021-01-22 09:36

    try putting the event.preventDefault(); bellow the $state.go.

    This is where I saw the idea for this suggestion: angularjs app.run doesn't get called with state

    So basically:

    AuthManager.openConnectionPane().then( function( data ) { if( AuthManager.isUserConnected() ) { console.log("This message is correctly printed!"); $state.go( toState.name ); } }); event.preventDefault();

提交回复
热议问题