DEV Community

Discussion on: DRY Way to Manage Subscriptions in Angular Components

Collapse
 
2advancesolutions profile image
Batman • Edited

It’s a good idea to destroy observables using a helper class but not recommend to do this way as it causes each class or component to inherit the helper class to just destroy a subscription. If you expect a observer and want to kill it just Do pipe(take(1)) and if you expect a promise like user profile api request use.toPromise() instead of .subscribe(). I say this from experience using to helper method just cause extra code that’s not need. But great Article