(shouldHaveEmitted: boolean, emitEvent?: boolean)
| 1441 | } |
| 1442 | |
| 1443 | private _runAsyncValidator(shouldHaveEmitted: boolean, emitEvent?: boolean): void { |
| 1444 | if (this.asyncValidator) { |
| 1445 | this.status = PENDING; |
| 1446 | this._hasOwnPendingAsyncValidator = { |
| 1447 | emitEvent: emitEvent !== false, |
| 1448 | shouldHaveEmitted: shouldHaveEmitted !== false, |
| 1449 | }; |
| 1450 | const obs = toObservable(this.asyncValidator(this)); |
| 1451 | this._asyncValidationSubscription = obs.subscribe((errors: ValidationErrors | null) => { |
| 1452 | this._hasOwnPendingAsyncValidator = null; |
| 1453 | // This will trigger the recalculation of the validation status, which depends on |
| 1454 | // the state of the asynchronous validation (whether it is in progress or not). So, it is |
| 1455 | // necessary that we have updated the `_hasOwnPendingAsyncValidator` boolean flag first. |
| 1456 | this.setErrors(errors, {emitEvent, shouldHaveEmitted}); |
| 1457 | }); |
| 1458 | } |
| 1459 | } |
| 1460 | |
| 1461 | private _cancelExistingSubscription(): boolean { |
| 1462 | if (this._asyncValidationSubscription) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…