DEV Community

Discussion on: RxJS subscription management with Angular

Collapse
denisvalcke profile image
Denis • Edited on

We've made a service in one of our Angular packages to handle the takeUntil route more easily:
github.com/studiohyperdrive/ngx-to...

By providing the SubscriptionService on component level it follows the lifecycle of the component. So onDestroy it will also destroy and close subscriptions the exact same way you did here, except for not having to setup an observable for each component.