ComponentRef

ComponentRef

Stable Class

Class Overview

class ComponentRef {
  C 
  location : ElementRef
  injector : Injector
  instance : C
  hostView : ViewRef
  changeDetectorRef : ChangeDetectorRef
  componentType : Type<any>
  destroy() : void
  onDestroy(callback: Function) : void
}

Class Description

Represents an instance of a Component created via a ComponentFactory.

ComponentRef provides access to the Component Instance as well other objects related to this Component Instance and allows you to destroy the Component Instance via the destroy method.

Class Details

C
location : ElementRef

Location of the Host Element of this Component Instance.

injector : Injector

The injector on which the component instance exists.

instance : C

The instance of the Component.

hostView : ViewRef

The ViewRef of the Host View of this Component instance.

changeDetectorRef : ChangeDetectorRef

The ChangeDetectorRef of the Component instance.

componentType : Type<any>

The component type.

destroy() : void

Destroys the component instance and all of the data structures associated with it.

onDestroy(callback: Function) : void

Allows to register a callback that will be called when the component is destroyed.

exported from core-index, defined in core/src/linker/component_factory.ts

© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/docs/ts/latest/api/core/index/ComponentRef-class.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部