I have an application in which I route between children of a parent route in some situations. One will look like example.com/a/1/
another example.com/a/2/
will switching from 1
to 2
trigger a reload/render of the page a
?
Like playing a video in a
and have a routes outlet as sibling to that video, will this change of page trigger the video to reload?
If so, can this be prevented?
No, it won't. The parent component will only be refreshed if you navigate away from it and then navigate to it again.
I have got the solution:
constructor(private _router:Router,private _activatedRoute:ActivatedRoute){}
this._router.events.subscribe(event => {
if (event instanceof NavigationEnd) {
// this._activatedRoute.snapshot is up to date
}
});
Works like a charm
Credit: Angular Issue
Solution by @skreborn
Thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With