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

Function setInputsFromAttrs

packages/core/src/render3/instructions/shared.ts:572–593  ·  view source on GitHub ↗

* Sets initial input properties on directive instances from attribute data * * @param lView Current LView that is being processed. * @param directiveIndex Index of the directive in directives array * @param instance Instance of the directive on which to set the initial inputs * @param def The d

(
  lView: LView,
  directiveIndex: number,
  instance: T,
  def: DirectiveDef<T>,
  tNode: TNode,
  initialInputData: InitialInputData,
)

Source from the content-addressed store, hash-verified

570 * @param tNode The static data for this node
571 */
572function setInputsFromAttrs<T>(
573 lView: LView,
574 directiveIndex: number,
575 instance: T,
576 def: DirectiveDef<T>,
577 tNode: TNode,
578 initialInputData: InitialInputData,
579): void {
580 const initialInputs: InitialInputs | null = initialInputData![directiveIndex];
581 if (initialInputs !== null) {
582 for (let i = 0; i < initialInputs.length; i += 2) {
583 const lookupName = initialInputs[i];
584 const value = initialInputs[i + 1];
585
586 writeToDirectiveInput<T>(def, instance, lookupName, value);
587
588 if (ngDevMode) {
589 setNgReflectProperty(lView, tNode, def.inputs[lookupName][0], value);
590 }
591 }
592 }
593}
594
595/** Shared code between instructions that indicate the start of an element. */
596export function elementLikeStartShared(

Callers 1

instantiateAllDirectivesFunction · 0.85

Calls 2

writeToDirectiveInputFunction · 0.90
setNgReflectPropertyFunction · 0.85

Tested by

no test coverage detected