MCPcopy Create free account
hub / github.com/angular/angular / constructor

Method constructor

packages/core/src/render3/component_ref.ts:562–576  ·  view source on GitHub ↗
(
    componentType: Type<T>,
    private readonly _rootLView: LView,
    private readonly _hasInputBindings: boolean,
  )

Source from the content-addressed store, hash-verified

560 private _tNode: TElementNode | TContainerNode | TElementContainerNode;
561
562 constructor(
563 componentType: Type<T>,
564 private readonly _rootLView: LView,
565 private readonly _hasInputBindings: boolean,
566 ) {
567 super();
568 this._tNode = getTNode(_rootLView[TVIEW], HEADER_OFFSET) as TElementNode;
569 this.location = createElementRef(this._tNode, _rootLView);
570 this.instance = getComponentLViewByIndex(this._tNode.index, _rootLView)[CONTEXT] as T;
571 this.hostView = this.changeDetectorRef = new ViewRef<T>(
572 _rootLView,
573 undefined /* _cdRefInjectingView */,
574 );
575 this.componentType = componentType;
576 }
577
578 override setInput(name: string, value: unknown): void {
579 if (this._hasInputBindings && ngDevMode) {

Callers

nothing calls this directly

Calls 3

getTNodeFunction · 0.90
createElementRefFunction · 0.90
getComponentLViewByIndexFunction · 0.90

Tested by

no test coverage detected