Angular component are not getting destroyed

前端 未结 2 2016
庸人自扰
庸人自扰 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:35

    Every component has a lifecycle you need to use:

    OnDestroy();
    

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

提交回复
热议问题