Defer Angular UI Router $stateChangeStart until server authorization response receieved
问题 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 access certains routes. The problem is that $stateChangeStart is running before I receive the response back from the authorization endpoint. Here's some code (coffeescript with js below) - this is all within my run block. app.run(($rootScope, $state, $stateParams, $log, Auth) -> currentState = 'home' $rootScope.$state = $state