DEV Community

loading...

Angular: Refetch data on same URL navigation

kreuzerk profile image kreuzerk Originally published at Medium on ・1 min read

Different approaches with their pros and cons

Real time applications normally use WebSockets or some server push technology. In case the backend doesn’t support a push technology we often use some sort of polling mechanism to get the latest data.

However there are use cases where we want to give control to the user and let him decide when the data should be refreshed. For example by clicking on a refresh button or a route navigation item while that particular route is already displayed.

By default the router doesn’t emit router events when we try to navigate to the same URL that is already activated. Which generally is a good thing.

But how can we refetch data on route refresh? 🤔

Find out more...

Discussion (0)

pic
Editor guide