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 not working properly with child states. #3731

Closed codymikol closed 4 years ago

codymikol commented 5 years ago

This issue tracker is for Bug Reports and Feature Requests only.

Please direct requests for help to StackOverflow. See http://bit.ly/UIR-SOF for details.

This is a (check one box):

My version of UI-Router is: 1.0.19

Bug Report

Current Behavior:

When using $state.target to activate a child state I expect the onEnter hook to be triggered once. For some reason it is triggered 20 times and I am not able to reach that child state. This doesn't seem to be an issue if I use $state.go instead, but then I receive a superseded transition error.

You can see this if you change the only instance of $state.target to $state.go in the workflow state.

Even stranger when logging each $state every time that the onEnter hook is triggered it reports that I am on an empty state.

Expected Behavior:

Using $state.target on a child state triggers the onEnter hook once for the state I am transitioning to and takes me to that state successfully.

Link to Plunker or stackblitz that reproduces the issue:

https://codepen.io/codymikol/pen/RBeLzo?editors=1111

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.