DEV Community

kreuzerk
kreuzerk

Posted on • Originally published at Medium on

Angular: Refetch data on same URL navigation

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...

Top comments (0)