MCPcopy
hub / github.com/angular/angular / outputBinding

Function outputBinding

packages/core/src/render3/dynamic_bindings.ts:181–196  ·  view source on GitHub ↗
(eventName: string, listener: (event: T) => unknown)

Source from the content-addressed store, hash-verified

179 * @see [Binding inputs, outputs and setting host directives at creation](guide/components/programmatic-rendering#binding-inputs-outputs-and-setting-host-directives-at-creation)
180 */
181export function outputBinding<T>(eventName: string, listener: (event: T) => unknown): Binding {
182 // Note: ideally we would use a class here, but it seems like they
183 // don't get tree shaken when constructed by a function like this.
184 const binding: BindingInternal = {
185 [BINDING]: OUTPUT_BINDING_METADATA,
186 create: () => {
187 const lView = getLView<{} | null>();
188 const tNode = getCurrentTNode()!;
189 const tView = lView[TVIEW];
190 const targetDef = tView.directiveRegistry![binding.targetIdx!];
191 createOutputListener(tNode, lView, listener, targetDef, eventName);
192 },
193 };
194
195 return binding;
196}
197
198/**
199 * Creates a two-way binding.

Callers 3

test_bed_spec.tsFile · 0.90
twoWayBindingFunction · 0.85

Calls 3

getLViewFunction · 0.90
getCurrentTNodeFunction · 0.90
createOutputListenerFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…