1

1- Create a dynamic component.

2- Subscribe to route.params observable.

3- Inject the dynamic component into some component.

4- Destroy and re-create the dymamic component.

Do I need to Unsubscribe from the route.params observable if they are used inside a dynamic component?

Mah moo
  • 43
  • 5

1 Answers1

1

As per this answer, you should:

Unsubscribe from the ActivatedRoute observables like route.params if they are subscribed inside a nested (Added inside tpl with the component selector) or dynamic component as they may be subscribed many times as long as the parent/host component exists. No need to unsubscribe from them in other scenarios as mentioned in the quote above from Routing & Navigation docs.

Hamza
  • 46
  • 3