-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
i've got this setup where i'm trying to do some authorization checking in stateChangeStart
, and it looks something like this (in coffee-script):
$rootScope.$on '$stateChangeStart', (event, toState, toParams, fromState, fromParams) ->
authentication.initCurrentUser().then (resolution) ->
if authorization.requiresAuthentication(toState)
$state.go 'login'
else
$state.go toState.name
event.preventDefault()
so it always calls event.preventDefault()
because we need to wait for the resolution of the promise returned by initCurrentUser()
to figure out if we are cleared for transition, but it seems like i can't transition in the then()
block and it even looks like it gets into an infinite loop.
as always, possible it's operator error, but i was just wondering off the bat if anyone with a deeper understanding of the internals can spot something obviously flawed about what i'm attempting to do.
regards,
tony.
Metadata
Metadata
Assignees
Labels
No labels