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

$stateRegistry.onStatesChanged does not fire for lazy loaded states referenced by non-lazy loaded state #3682

Closed blah238 closed 6 years ago

blah238 commented 6 years ago

This is a (check one box):

My version of UI-Router is:

angular: 1.6.5
@uirouter/core: 5.0.11
@uirouter/angularjs: 1.0.11

Bug Report

Current Behavior:

If a parent state is declared within a lazyLoad function and a descendant state declaration references this state outside of a lazyLoad function, the $stateRegistry.onStatesChanged event is not triggered for the lazy loaded state.

Expected Behavior:

I would expect a lazy loaded state to have the $stateRegistry.onStatesChanged event triggered even if it is referenced by a non lazy loaded state declaration.

Link to Plunker or stackblitz that reproduces the issue:

https://stackblitz.com/edit/ui-router-angularjs-ejwh3n?file=app.js

Repro steps:

  1. Toggle the Console window and look for the messages about states being registered
  2. Click the lazy link at the top.
  3. Note that the message for the lazy state being registered is missing unless you comment out line 41.
christopherthielen commented 6 years ago

This issue was moved to ui-router/core#170