Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 16 takeUntilDestroyed operator with two subscribe methods

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)
  }
like image 817
Dmitriy Ivanko Avatar asked Mar 25 '26 15:03

Dmitriy Ivanko


1 Answers

This issue has been fixed with the release of the 16.0.2 !

like image 190
Matthieu Riegler Avatar answered Mar 29 '26 12:03

Matthieu Riegler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!