I\'m trying to block all ui-router state changes until I\'ve authenticated the user:
$rootScope.$on(\'$stateChangeStart\', function (event, next, toParams) {
Fakeout. This is an interaction issue between $urlRouterProvider
and $stateProvider
. I shouldn't be using $urlRouterProvider
for my otherwise
. I should be using something like:
$stateProvider.state("otherwise", {
url: "*path",
template: "Invalid Location",
controller: [
'$timeout','$state',
function($timeout, $state ) {
$timeout(function() {
$state.go('/foo')
},2000)
}]
});
Or even a transparent'ish redirect:
$stateProvider.state("otherwise", {
url: "*path",
template: "",
controller: [
'$state',
function($state) {
$state.go('/foo')
}]
});
Altogether now: