Example from (https://indepth.dev/posts/1518/takeuntildestroy-in-angular-v16) This works for one subscribe method but doesn't work for two methods
If you look at the following code, then when the component is destroyed, the second subscription will exist. I just can't understand why and how to make the code work for any number of subscriptions in the component? Perhaps I misunderstood something?
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'
constructor(
) {
interval(1000).pipe(
takeUntilDestroyed(),
).subscribe(console.log)
interval(1000).pipe(
takeUntilDestroyed(),
).subscribe(console.log)
}
This issue has been fixed with the release of the 16.0.2 !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With