Defer Angular UI Router $stateChangeStart until server authorization response receieved

前端 未结 4 437
攒了一身酷
攒了一身酷 2020-12-16 15:19

I have an Angular app using UI Router where I\'m trying to validate a user\'s token, if one exists, when the app runs. I am also checking that the user has permission to acc

4条回答
  •  自闭症患者
    2020-12-16 16:01

    You should call $urlRouter.sync() after you have got user data. Also you might want to protect $stateChangeStart by using event.preventDefault() in case when user was not obtained.

提交回复
热议问题