MCPcopy
hub / github.com/angular/angular / inputBindingUpdate

Function inputBindingUpdate

packages/core/src/render3/dynamic_bindings.ts:80–112  ·  view source on GitHub ↗
(targetDirectiveIdx: number, publicName: string, value: unknown)

Source from the content-addressed store, hash-verified

78// - move more logic to the first creation pass
79// - move this function to under the instructions folder
80function inputBindingUpdate(targetDirectiveIdx: number, publicName: string, value: unknown) {
81 const lView = getLView();
82 const bindingIndex = nextBindingIndex();
83 if (bindingUpdated(lView, bindingIndex, value)) {
84 const tView = lView[TVIEW];
85 const tNode = getSelectedTNode();
86
87 const componentLView = getComponentLViewByIndex(tNode.index, lView);
88 markViewDirty(componentLView, NotificationSource.SetInput);
89
90 // TODO(pk): don't check on each and every binding, just assert in dev mode
91 const targetDef = tView.directiveRegistry![targetDirectiveIdx];
92 if (ngDevMode && !targetDef) {
93 throw new RuntimeError(
94 RuntimeErrorCode.NO_BINDING_TARGET,
95 `Input binding to property "${publicName}" does not have a target.`,
96 );
97 }
98
99 // TODO(pk): the hasSet check should be replaced by one-off check in the first creation pass
100 const hasSet = setDirectiveInput(tNode, tView, lView, targetDef, publicName, value);
101
102 if (ngDevMode) {
103 if (!hasSet) {
104 throw new RuntimeError(
105 RuntimeErrorCode.NO_BINDING_TARGET,
106 `${stringifyForError(targetDef.type)} does not have an input with a public name of "${publicName}".`,
107 );
108 }
109 storePropertyBindingMetadata(tView.data, tNode, publicName, bindingIndex);
110 }
111 }
112}
113
114/**
115 * Creates an input binding.

Callers 1

inputBindingFunction · 0.85

Calls 9

getLViewFunction · 0.90
nextBindingIndexFunction · 0.90
bindingUpdatedFunction · 0.90
getSelectedTNodeFunction · 0.90
getComponentLViewByIndexFunction · 0.90
markViewDirtyFunction · 0.90
setDirectiveInputFunction · 0.90
stringifyForErrorFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…