Reputation: 92
I'm using RouteReuseStrategy to control of route snapshot caching, it is working fine going to another component from my search component and when I click "back" I have the old(search) component there like was. The problem is, if I go to another component and edit some value and back to search, that value edited still the old one and not the new one. How can I use the current data?
Thanks.
Upvotes: 0
Views: 1333
Reputation:
Tell your router how to behave on your component.
Start by telling him to propagate routing events in your component with
this.router.onSameUrlNavigation = 'reload';
Next, tell him to do something on routing events, particularly on the last event
this.router.events.subscribe(event => {
if (!(event instanceof NavigationEnd)) { return; }
// Do what you need to do here, for instance :
ngOnInit();
});
Upvotes: 2