填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写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