(shouldHaveEmitted: boolean, emitEvent?: boolean)
| 1464 | } |
| 1465 | |
| 1466 | private _runAsyncValidator(shouldHaveEmitted: boolean, emitEvent?: boolean): void { |
| 1467 | if (this.asyncValidator) { |
| 1468 | this.status = PENDING; |
| 1469 | this._hasOwnPendingAsyncValidator = { |
| 1470 | emitEvent: emitEvent !== false, |
| 1471 | shouldHaveEmitted: shouldHaveEmitted !== false, |
| 1472 | }; |
| 1473 | const obs = toObservable(this.asyncValidator(this)); |
| 1474 | this._asyncValidationSubscription = obs.subscribe((errors: ValidationErrors | null) => { |
| 1475 | this._hasOwnPendingAsyncValidator = null; |
| 1476 | // This will trigger the recalculation of the validation status, which depends on |
| 1477 | // the state of the asynchronous validation (whether it is in progress or not). So, it is |
| 1478 | // necessary that we have updated the `_hasOwnPendingAsyncValidator` boolean flag first. |
| 1479 | this.setErrors(errors, {emitEvent, shouldHaveEmitted}); |
| 1480 | }); |
| 1481 | } |
| 1482 | } |
| 1483 | |
| 1484 | private _cancelExistingSubscription(): boolean { |
| 1485 | if (this._asyncValidationSubscription) { |
nothing calls this directly
no test coverage detected