MCPcopy Index your code
hub / github.com/angular/angular / _runAsyncValidator

Function _runAsyncValidator

packages/forms/src/model/abstract_model.ts:1443–1459  ·  view source on GitHub ↗
(shouldHaveEmitted: boolean, emitEvent?: boolean)

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 3

toObservableFunction · 0.90
setErrorsMethod · 0.80
subscribeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…