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

Function onChange

packages/forms/src/directives/shared.ts:293–299  ·  view source on GitHub ↗
(newValue?: any, emitModelEvent?: boolean)

Source from the content-addressed store, hash-verified

291
292function setUpModelChangePipeline(control: FormControl, dir: NgControl): void {
293 const onChange = (newValue?: any, emitModelEvent?: boolean) => {
294 // control -> view
295 dir.valueAccessor!.writeValue(newValue);
296
297 // control -> ngModel
298 if (emitModelEvent) dir.viewToModelUpdate(newValue);
299 };
300 control.registerOnChange(onChange);
301
302 // Register a callback function to cleanup onChange handler

Callers 1

setupSwMethod · 0.85

Calls 2

writeValueMethod · 0.65
viewToModelUpdateMethod · 0.45

Tested by

no test coverage detected