angular-ui / ui-router

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

$state.target('login') Not working #3612

Closed jeprojects closed 4 years ago

jeprojects commented 6 years ago

This is a (check one box):

My version of UI-Router is: 1.0.13

Bug Report

Current Behavior:

When issuing $state.target('login'), it isn't redirecting. I have enabled debugging and here is the output:

Transition #0-0: <- Success "Transition#0( ''{} -> '/c'{} )", final state: /c

If I used $state.go('login') everything works fine, but there is an error: "The transition has been superseded by a different transition"

Expected Behavior:

It should redirect to 'login'

jutaz commented 6 years ago

That error is expected, as it’s an internal “error” for UI.router, which tells it to abort current transition target, and switch to the new one.

adrianboimvaser commented 5 years ago

How do I differentiate it from a real error, say a resolve being rejected?

jutaz commented 5 years ago

Each rejection has a type property. A list of the codes can be found in https://github.com/ui-router/core/blob/23742e3e02faee73f2f12211910531f92f22b01f/src/transition/rejectFactory.ts#L7

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.