2

I have an option to change a server url in the app (for internal testing purposes).

The problem is once the components have been instantiated by navigating to them, they dont initialize again, although it is desired (to call the new api).

I am looking for a way to either restart the application or to clear the router history whilst also clearing all instances of components instantiated by the router. This doesn't work for me:

this.router.navigate(['/'], { clearHistory: true });

It clears the history, but once the components have been instantiated, they dont get created again.

Zoidy
  • 362
  • 4
  • 21

1 Answers1

2

update

This has landed

See this blogpost about how to implement your custom reuse strategy https://www.softwarearchitekt.at/post/2016/12/02/sticky-routes-in-angular-2-3-with-routereusestrategy.aspx

original

This is not yet supported.

https://github.com/angular/angular/pull/13124 is supposed to allow to define if and when the component should be reused or not re-created.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567