In angular application, every time I route to a new page, my earlier page\'s component is staying in memory. It\'s not getting destroyed and when I route back to that page it cr
Actually, I tried running the above Github application in production mode and the issue got resolved. But the actual issue in my production application still exists. But that is related to something else. I will post a new question for that.
Every component has a lifecycle you need to use:
OnDestroy();
and you need to implements the method ngOnDestroy()
.
Follow this