I\'m trying to block all ui-router state changes until I\'ve authenticated the user:
$rootScope.$on(\'$stateChangeStart\', function (event, next, toParams) {
Looks like this is a bug with ui-router when you use the combination of $urlRouterProvider.otherwise("/foo) with the $stateChangeStart.
Issue - https://github.com/angular-ui/ui-router/issues/600
Frank Wallis provides a nice workaround, use the longer form of the otherwise method that takes a function as an argument:
$urlRouterProvider.otherwise( function($injector, $location) {
var $state = $injector.get("$state");
$state.go("app.home");
});
Nice work Frank!