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 @angular/core/index, defined in @angular/core/src/linker/component_factory.ts

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