UntilOnDestroy decorator
Allow you unsubscribe subscriptions when component was destroying. Can be used with Angular 5-10
How to use it
;;;; @ implements OnInit OnDestroy id: string; { // not necessary after Angular 9 this; } { } // not necessary after Angular 9 @ : Subscription return
You can aply it to methods of components or directives only. Not in services. Method should return Subscription or Subscriptions array.
When component/directive will be destroyed, all subscriptions from decorated methods will be unsubscribed.
From Angular 9 ang higher you have not to implement OnInit and OnDestroy.