填寫這份《一分鐘調查》,幫我們(開發組)做得更好!去填寫Home

ViewRef

表示一個 Angular 檢視

Represents an Angular view.

      
      abstract class ViewRef extends ChangeDetectorRef {
  abstract destroyed: boolean
  abstract destroy(): void
  abstract onDestroy(callback: Function): any

  // 繼承自 core/ChangeDetectorRef
  abstract markForCheck(): void
  abstract detach(): void
  abstract detectChanges(): void
  abstract checkNoChanges(): void
  abstract reattach(): void
}
    

參見

屬性

屬性說明
abstract destroyed: boolean唯讀

報告此檢視是否已被銷燬。

Reports whether this view has been destroyed.

方法

銷燬該檢視以及與之關聯的所有資料結構。

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

      
      abstract destroy(): void
    
引數

沒有引數。

返回值

void

生命週期鉤子,為檢視提供其他由開發人員定義的清理功能。

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

      
      abstract onDestroy(callback: Function): any
    
引數
callback Function

處理函式,用於清理與檢視關聯的由開發人員定義的資料。在呼叫 destroy() 方法時呼叫。

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

返回值

any