You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a weird error that I've been having on my production app, but found it very hard to accurately reproduce. For now the fix in #600 (comment) works for me.
The app has secure and unsecure states, defined by some extra data on the state definition. On $stateChangeStart I check if the state is marked as secure, and if so, if the current user is authenticated.
If an unauthenticated user is trying to access a secure resource, he gets redirected to the unsecured state.
Upon loading the app, the user is directed to a secured state by default (via $urlRouterProvider.otherwise) because he might already be logged previously.
The problem happens here. A user enters the app, the $stateChangeStart gets fired, I detect he is not authenticated, call event.preventDefault() and $state.go('unsecure-state'). This sends angular into a infinite digest loop bouncing back between the secure and unsecured states.
What makes this odd is that it seems to be dependent on the target state having a templateUrl instead of an inline template. On the plunker, change the template of the secure state from templateUrl: "./unsecure.html" to template: "unsecure" and infinite digest dissapears.
The text was updated successfully, but these errors were encountered:
This is a weird error that I've been having on my production app, but found it very hard to accurately reproduce. For now the fix in #600 (comment) works for me.
You can see the error happening on this plunkr: http://plnkr.co/edit/L8DhCNG7cyipBsBypWg3
The app has secure and unsecure states, defined by some extra data on the state definition. On
$stateChangeStart
I check if the state is marked as secure, and if so, if the current user is authenticated.If an unauthenticated user is trying to access a secure resource, he gets redirected to the unsecured state.
Upon loading the app, the user is directed to a secured state by default (via
$urlRouterProvider.otherwise
) because he might already be logged previously.The problem happens here. A user enters the app, the
$stateChangeStart
gets fired, I detect he is not authenticated, callevent.preventDefault()
and$state.go('unsecure-state')
. This sends angular into a infinite digest loop bouncing back between the secure and unsecured states.What makes this odd is that it seems to be dependent on the target state having a
templateUrl
instead of an inline template. On the plunker, change the template of thesecure
state fromtemplateUrl: "./unsecure.html"
totemplate: "unsecure"
and infinite digest dissapears.The text was updated successfully, but these errors were encountered: