Angular: Refetch data on same URL navigation
kreuzerk
Posted on November 27, 2018
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? 🤔
💖 💪 🙅 🚩
kreuzerk
Posted on November 27, 2018
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.