* Merges asynchronous validators into a single validator function. * See `Validators.composeAsync` for additional information.
(validators: (AsyncValidatorFn | null)[])
| 686 | * See `Validators.composeAsync` for additional information. |
| 687 | */ |
| 688 | function 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 |
no test coverage detected
searching dependent graphs…