DEV Community

Discussion on: This Angular helper function has saved me from memory leaks for 4 years

Collapse
 
martinspire profile image
Martin Spierings

pipe(take(1)) also helps but you can also make an onDestroyService that automatically runs unsubscribe on your subscriptions. If you always add them to this.subscriptions, it will work fine.