Skip to content

Instantly share code, notes, and snippets.

@NyaGarcia
Created June 27, 2022 09:42
Show Gist options
  • Save NyaGarcia/1e843737e543cba44d42135f628df493 to your computer and use it in GitHub Desktop.
Save NyaGarcia/1e843737e543cba44d42135f628df493 to your computer and use it in GitHub Desktop.
Using takUntil to make the Observable complete
dialogRef
.afterClosed()
.pipe(
filter(Boolean),
tap((pokemon) => this.pokedexService.create(pokemon)),
takeUntil(this.destroyed$) // Will force the Observable to complete when destroyed$ emits a value
)
.subscribe();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment