ComponentRef
class
Represents a component created by a ComponentFactory
. Provides access to the component instance and related objects, and provides the means of destroying the instance.
abstract class ComponentRef<C> { abstract location: ElementRef abstract injector: Injector abstract instance: C abstract hostView: ViewRef abstract changeDetectorRef: ChangeDetectorRef abstract componentType: Type<any> abstract destroy(): void abstract onDestroy(callback: Function): void }
Properties
Property | Description |
---|---|
abstract location: ElementRef |
Read-only. The host or anchor element for this component instance. |
abstract injector: Injector |
Read-only. The dependency injector for this component instance. |
abstract instance: C |
Read-only. This component instance. |
abstract hostView: ViewRef |
Read-only. The host view defined by the template for this component instance. |
abstract changeDetectorRef: ChangeDetectorRef |
Read-only. The change detector for this component instance. |
abstract componentType: Type<any> |
Read-only. The component type. |
Methods
destroy() |
---|
Destroys the component instance and all of the data structures associated with it. |
|
onDestroy() | |||
---|---|---|---|
A lifecycle hook that provides additional developer-defined cleanup functionality for the component. | |||
|
callback | Function | A handler function that cleans up developer-defined data associated with this component. Called when the |
Returns
void
© 2010–2019 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v7.angular.io/api/core/ComponentRef