DEV Community

Discussion on: Mastering Angular 8: five things that are good to know to save your time.

Collapse
 
juristr profile image
Juri Strumpflohner

Nice article. Regarding the reloading of the component when navigating to the same URL you could also use the router config

RouterModule.forRoot(routes, {
    onSameUrlNavigation: 'reload'
})

Obviously just if you want to have that behavior for the entire app

Collapse
 
oleksandr profile image
Oleksandr • Edited

Thanks, Juri!

Collapse
 
wojtrawi profile image
Wojciech Trawiński

This will not mount component once again!!!
It only ensures that router events will be emitted.
If you navigate to the same route (like from cars/2 to cars/3) it's the RouteReuseStrategy which determines whether a component should be mounted once again.
See here for an example where it's overridden in order to make animations work as expected medium.com/frontend-coach/angular-...