Do I have to unsubscribe from ActivatedRoute (e.g. params) observables?

前端 未结 5 879
既然无缘
既然无缘 2020-12-01 10:17

I find many examples where ActivatedRoute Observables like params or url are subscribed but not unsubscribed.

construc         


        
5条回答
  •  旧时难觅i
    2020-12-01 10:52

    Whenever you are adding subscribe to a component, you always almost need to unsubscribe when the component is getting destroyed. But subscribe to the Activated route params doesn't require to unsubscribe as the router destroys the subscribe whenever its no longer needed.

提交回复
热议问题