Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

takeUntilDestroyed

Operator which completes the Observable when the calling context (component, directive, service, etc) is destroyed.

      
      takeUntilDestroyed<T>(destroyRef?: DestroyRef): MonoTypeOperatorFunction<T>
    
Parameters
destroyRef DestroyRef

optionally, the DestroyRef representing the current context. This can be passed explicitly to use takeUntilDestroyed outside of an injection context. Otherwise, the current DestroyRef is injected.

Optional. Default is undefined.

Returns

MonoTypeOperatorFunction<T>