angular-ui / ui-router

The de-facto solution to flexible routing with nested views in AngularJS
http://ui-router.github.io/
MIT License
13.54k stars 3k forks source link

$transitions.onError does not allow redirection by returning TargetState #3519

Closed Bennit closed 4 years ago

Bennit commented 7 years ago

My version of UI-Router is: 1.0.6

Bug Report

Current Behavior:

TransitionHookFn returns a TargetState but no transition is made

Expected Behavior:

if TransitionHookFn returns a TargetState, the application is routed towards it.

How to reproduce

https://gist.github.com/Bennit/01dc9acacbaa3a119ae2af2f0e1003a1

alazzawimahmoud commented 7 years ago

+1

Bennit commented 7 years ago

I've seen on https://github.com/angular-ui/ui-router/issues/3331 that they indicate the rejection of a resolve is not supposed to alter a transition; however from the docs it seems like $transitions.onError should be able to - which is truthy?

aitrusgit commented 6 years ago

+1 I managed to workaround this by, instead of returning a TargetState, invoking $state.go("recovery-state", {}). However this strategy won't prevent $defaultErrorHandler from being triggered and polluting the console with errors.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

This does not mean that the issue is invalid. Valid issues may be reopened.

Thank you for your contributions.