• Overview
@angular/core

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> {}
  
  

setInput

void

Updates a specified input name to a new value. Using this method will properly mark for check component using the OnPush change detection strategy. It will also assure that the OnChanges lifecycle hook runs when a dynamically created component is change-detected.

@paramnamestring

The name of an input.

@paramvalueunknown

The new value of an input.

@returnsvoid

location

The host or anchor element for this component instance.

injector

The dependency injector for this component instance.

instance

C

This component instance.

hostView

The host view defined by the template for this component instance.

changeDetectorRef

The change detector for this component instance.

componentType

Type<any>

The type of this component (as created by a ComponentFactory class).

destroy

void

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

@returnsvoid

onDestroy

void

A lifecycle hook that provides additional developer-defined cleanup functionality for the component.

@paramcallbackFunction

A handler function that cleans up developer-defined data associated with this component. Called when the destroy() method is invoked.

@returnsvoid
Jump to details