4

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:

  • Open this plunker
  • On 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.

enter image description here

  • On HomeComponent, things work as expected. Triggering navigation executes the ActivatedRoute.params.subscribe() callback but the component is not re-initialized

enter image description here

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?

1 Answer 1

1

This is an Angular bug. It has been reported and the next version should be fixed. See https://github.com/angular/angular/pull/10707

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.