When I navigate to my component after the first time, with router.navigate, the ngOnInit method of the component is not called.
Therefore, the previous data I fetched from API is still there. I need to reset all the variables when I navigate away from the page, so the next time the component is re-built from scratch again.
How can I achieve it?
I tried to google for solutions, I tried to change some code, I unsubscribed inside ngOnDestroy but nothing changed.
you can use