Skip to content

transition hook injects from wrong state #3546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks
i23591326 opened this issue Oct 10, 2017 · 1 comment
Closed
2 tasks

transition hook injects from wrong state #3546

i23591326 opened this issue Oct 10, 2017 · 1 comment
Labels
Milestone

Comments

@i23591326
Copy link

i23591326 commented Oct 10, 2017

This is a:

  • [*] Bug Report
  • Feature Request
  • General Query

My version of UI-Router is: 1.0.5

Bug Report

Current Behavior:

I have two states: people and people.person.

Each state has different resolve with same token 'person'. For people state resolve just returns 123.
people state has transition hook (onEnter: function(person){console.log(person)}) with dependency 'person'.
When i load app and go https://run.plnkr.co/YQSDfiSkqAmmxVd9/#/people/
i see in console: 123

When i load app and go directly https://run.plnkr.co/fqaJMXD8mb7cMjxI/#/people/293
i see in console: undefined

it seems onEnter hook trying to inject resolve from wrong (child or last) state when child state contains resolve with the same token

Expected Behavior:

transition hook can inject resolves only from current or parent states

Link to Plunker that reproduces the issue:

https://plnkr.co/edit/2Jk549su23F789BNTnb1?p=preview

by the way dependency injection inside resolve "people: function(PeopleService, person) {console.log(person))...}" works perfectly fine no matter which state i go first when app is loaded

@christopherthielen
Copy link
Contributor

christopherthielen commented Dec 21, 2017

Thanks for the bug report. This is definitely a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants