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

Function composeAsync

packages/forms/src/validators.ts:688–699  ·  view source on GitHub ↗

* Merges asynchronous validators into a single validator function. * See `Validators.composeAsync` for additional information.

(validators: (AsyncValidatorFn | null)[])

Source from the content-addressed store, hash-verified

686 * See `Validators.composeAsync` for additional information.
687 */
688function composeAsync(validators: (AsyncValidatorFn | null)[]): AsyncValidatorFn | null {
689 if (!validators) return null;
690 const presentValidators: AsyncValidatorFn[] = validators.filter(isPresent) as any;
691 if (presentValidators.length == 0) return null;
692
693 return function (control: AbstractControl) {
694 const observables = executeValidators<AsyncValidatorFn>(control, presentValidators).map(
695 toObservable,
696 );
697 return forkJoin(observables).pipe(map(mergeErrors));
698 };
699}
700
701/**
702 * Accepts a list of async validators of different possible shapes (`AsyncValidator` and

Callers 2

composeAsyncMethod · 0.85
composeAsyncValidatorsFunction · 0.85

Calls 3

executeValidatorsFunction · 0.85
mapMethod · 0.80
filterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…