ComponentRef

export class ComponentRef

exported from angular2/core defined in angular2/src/core/linker/dynamic_component_loader.ts (line 7)

Represents an instance of a Component created via DynamicComponentLoader.

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 dispose method.

Members

injector : Injector

The injector provided DynamicComponentLoader.

TODO(i): this api is useless and should be replaced by an injector retrieved from the HostElementRef, which is currently not possible.

location : ElementRef

Location of the Host Element of this Component Instance.

instance : any

The instance of the Component.

componentType : Type

The user defined component type, represented via the constructor function.

hostView : HostViewRef

The ViewRef of the Host View of this Component instance.

dispose()

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

TODO(i): rename to destroy to be consistent with AppViewManager and ViewContainerRef