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.

ViewRef

Represents an Angular view.

      
      abstract class ViewRef extends ChangeDetectorRef {
  abstract destroyed: boolean
abstract destroy(): void
abstract onDestroy(callback: Function): void // inherited from core/ChangeDetectorRef
abstract markForCheck(): void
abstract detach(): void
abstract detectChanges(): void
abstract checkNoChanges(): void
abstract reattach(): void }

Subclasses

See also

Properties

Property Description
abstract destroyed: boolean Read-Only

Reports whether this view has been destroyed.

Methods

Destroys this view and all of the data structures associated with it.

      
      abstract destroy(): void
    
Parameters

There are no parameters.

Returns

void

A lifecycle hook that provides additional developer-defined cleanup functionality for views.

      
      abstract onDestroy(callback: Function): void
    
Parameters
callback Function

A handler function that cleans up developer-defined data associated with a view. Called when the destroy() method is invoked.

Returns

void