(control: FormControl, dir: NgControl)
| 289 | } |
| 290 | |
| 291 | function setUpModelChangePipeline(control: FormControl, dir: NgControl): void { |
| 292 | const onChange = (newValue?: any, emitModelEvent?: boolean) => { |
| 293 | // control -> view |
| 294 | dir.valueAccessor!.writeValue(newValue); |
| 295 | |
| 296 | // control -> ngModel |
| 297 | if (emitModelEvent) dir.viewToModelUpdate(newValue); |
| 298 | }; |
| 299 | control.registerOnChange(onChange); |
| 300 | |
| 301 | // Register a callback function to cleanup onChange handler |
| 302 | // from a control instance when a directive is destroyed. |
| 303 | dir._registerOnDestroy(() => { |
| 304 | control._unregisterOnChange(onChange); |
| 305 | }); |
| 306 | } |
| 307 | |
| 308 | /** |
| 309 | * Links a FormGroup or FormArray instance and corresponding Form directive by setting up validators |
no test coverage detected
searching dependent graphs…