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

Function setNgReflectProperties

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

Source from the content-addressed store, hash-verified

388}
389
390export function setNgReflectProperties(
391 lView: LView,
392 tView: TView,
393 tNode: TNode,
394 publicName: string,
395 value: any,
396) {
397 const environment = lView[ENVIRONMENT];
398 if (!environment.ngReflect || !(tNode.type & (TNodeType.AnyRNode | TNodeType.Container))) {
399 return;
400 }
401
402 const inputConfig = tNode.inputs?.[publicName];
403 const hostInputConfig = tNode.hostDirectiveInputs?.[publicName];
404
405 if (hostInputConfig) {
406 for (let i = 0; i < hostInputConfig.length; i += 2) {
407 const index = hostInputConfig[i] as number;
408 const publicName = hostInputConfig[i + 1] as string;
409 const def = tView.data[index] as DirectiveDef<unknown>;
410 setNgReflectProperty(lView, tNode, def.inputs[publicName][0], value);
411 }
412 }
413
414 // Note: we set the private name of the input as the reflected property, not the public one.
415 if (inputConfig) {
416 for (const index of inputConfig) {
417 const def = tView.data[index] as DirectiveDef<unknown>;
418 setNgReflectProperty(lView, tNode, def.inputs[publicName][0], value);
419 }
420 }
421}
422
423/**
424 * Instantiate all the directives that were previously resolved on the current node.

Callers 2

ɵɵariaPropertyFunction · 0.90
setPropertyAndInputsFunction · 0.85

Calls 1

setNgReflectPropertyFunction · 0.85

Tested by

no test coverage detected