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

Function setAllInputsForProperty

packages/core/src/render3/instructions/shared.ts:749–782  ·  view source on GitHub ↗
(
  tNode: TNode,
  tView: TView,
  lView: LView,
  publicName: string,
  value: unknown,
)

Source from the content-addressed store, hash-verified

747 * @param value Value to set.
748 */
749export function setAllInputsForProperty(
750 tNode: TNode,
751 tView: TView,
752 lView: LView,
753 publicName: string,
754 value: unknown,
755): boolean {
756 const inputs = tNode.inputs?.[publicName];
757 const hostDirectiveInputs = tNode.hostDirectiveInputs?.[publicName];
758 let hasMatch = false;
759
760 if (hostDirectiveInputs) {
761 for (let i = 0; i < hostDirectiveInputs.length; i += 2) {
762 const index = hostDirectiveInputs[i] as number;
763 ngDevMode && assertIndexInRange(lView, index);
764 const publicName = hostDirectiveInputs[i + 1] as string;
765 const def = tView.data[index] as DirectiveDef<unknown>;
766 writeToDirectiveInput(def, lView[index], publicName, value);
767 hasMatch = true;
768 }
769 }
770
771 if (inputs) {
772 for (const index of inputs) {
773 ngDevMode && assertIndexInRange(lView, index);
774 const instance = lView[index];
775 const def = tView.data[index] as DirectiveDef<any>;
776 writeToDirectiveInput(def, instance, publicName, value);
777 hasMatch = true;
778 }
779 }
780
781 return hasMatch;
782}
783
784/**
785 * Sets an input value only on a specific directive and its host directives.

Callers 4

setInputMethod · 0.90
ɵɵariaPropertyFunction · 0.90
setPropertyAndInputsFunction · 0.85

Calls 2

assertIndexInRangeFunction · 0.90
writeToDirectiveInputFunction · 0.90

Tested by

no test coverage detected