Angular component are not getting destroyed

前端 未结 2 2017
庸人自扰
庸人自扰 2021-02-06 15:33

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

相关标签:
2条回答
  • 2021-02-06 16:18

    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.

    0 讨论(0)
  • 2021-02-06 16:35

    Every component has a lifecycle you need to use:

    OnDestroy();
    

    and you need to implements the method ngOnDestroy(). Follow this

    0 讨论(0)
提交回复
热议问题