(control: AbstractControl)
| 310 | } |
| 311 | |
| 312 | private updateControlFromCustom(control: AbstractControl): void { |
| 313 | // `_pendingValue` and `_pendingChange` are only declared on `FormControl` (same as in |
| 314 | // `listenToCustomControlModel`). |
| 315 | const value = (control as FormControl)._pendingValue; |
| 316 | // Clear the pending state before `setValue` so `valueChanges` and `events` subscribers don't |
| 317 | // observe a committed value that is still marked as pending. |
| 318 | (control as FormControl)._pendingChange = false; |
| 319 | this.clearPendingCustomValue(); |
| 320 | // The custom control is the source of `value`, so it already holds it. Record that before |
| 321 | // `setValue` so a `valueChanges` subscriber that synchronously sets a different value is |
| 322 | // still propagated by `ngControlUpdate`. |
| 323 | if (this.customControlBindings) { |
| 324 | this.customControlBindings.value = value; |
| 325 | } |
| 326 | if (control._pendingDirty) { |
| 327 | control.markAsDirty(); |
| 328 | } |
| 329 | control.setValue(value, {emitModelToViewChange: false}); |
| 330 | // Read `control.value` rather than `value` in case a `valueChanges` subscriber changed it. |
| 331 | this.viewToModelUpdate(control.value); |
| 332 | } |
| 333 | |
| 334 | private discardPendingCustomValue(control: AbstractControl): void { |
| 335 | if (!this.hasPendingCustomValue) { |
nothing calls this directly
no test coverage detected