Angular Basics: Refresh an Angular Component without reloading the same Component
If you are working with Angular and need to refresh a component without navigation on another component or without using
location.reload(), you can use the following code in your project:
Then, add this code to the required component’s constructor.
Make sure to
unsubscribe from this
Here, we just trick the router into believing that the last link was never visited; when the button is clicked, the program will load that component (refreshing the component).
This snippet will work in all Angular versions.
Credit: Source link