Skip to content

transition hook injects from wrong state #3546

Closed
@i23591326

Description

@i23591326

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions