Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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)
  }

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading