According to the Angular 2 docs :
By default, the router reuses a component instance when it re-navigates to the same component type without visiting a different component first. The parameters can change between each re-use
I need help figuring out why this does not work on my lazy-loaded routes. To reproduce:
LazyLoadedComponent
press Next ID
button to trigger navigation to the same route (new param). Notice that the component is destroyed and a new instance is initialized each time. HomeComponent
, things work as expected. Triggering navigation executes the ActivatedRoute.params.subscribe()
callback but the component is not re-initialized I'm using Angular 2 rc.5
and Angular Router 3 rc.1
Why does my lazy-loaded component not behave in accordance with the docs?
This is an Angular bug. It has been reported and the next version should be fixed. See https://github.com/angular/angular/pull/10707
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.