MCPcopy
hub / github.com/angular/angular / inputBinding

Function inputBinding

packages/core/src/render3/dynamic_bindings.ts:133–157  ·  view source on GitHub ↗
(publicName: string, value: () => unknown)

Source from the content-addressed store, hash-verified

131 * @see [Binding inputs, outputs and setting host directives at creation](guide/components/programmatic-rendering#binding-inputs-outputs-and-setting-host-directives-at-creation)
132 */
133export function inputBinding(publicName: string, value: () => unknown): Binding {
134 if (publicName === 'formField') {
135 const binding: BindingInternal = {
136 [BINDING]: INPUT_BINDING_METADATA,
137 create: () => {
138 controlCreateInternal();
139 },
140 update: () => {
141 // Update the [formField] input binding, regardless of whether this targets a 'FormField' directive.
142 inputBindingUpdate(binding.targetIdx!, publicName, value());
143 controlUpdateInternal();
144 },
145 };
146 return binding;
147 }
148
149 // Note: ideally we would use a class here, but it seems like they
150 // don't get tree shaken when constructed by a function like this.
151 const binding: BindingInternal = {
152 [BINDING]: INPUT_BINDING_METADATA,
153 update: () => inputBindingUpdate(binding.targetIdx!, publicName, value()),
154 };
155
156 return binding;
157}
158
159/**
160 * Creates an output binding.

Callers 9

test_bed_spec.tsFile · 0.90
constructorMethod · 0.90
resource_spec.tsFile · 0.90
form_field.spec.tsFile · 0.90
twoWayBindingFunction · 0.85

Calls 4

controlCreateInternalFunction · 0.90
controlUpdateInternalFunction · 0.90
inputBindingUpdateFunction · 0.85
valueFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…