AsyncValidator
An interface implemented by classes that perform asynchronous validation.
      
      interface AsyncValidator extends Validator {
  validate(control: AbstractControl): Promise<ValidationErrors | null> | Observable<ValidationErrors | null>
  // 继承自 forms/Validator
  validate(control: AbstractControl): ValidationErrors | null
  registerOnValidatorChange(fn: () => void)?: void
}
    方法
Method that performs async validation against the provided control.  | |||
      
      参数
 返回值
  | 
使用说明
Provide a custom async validator directive
The following example implements the AsyncValidator interface to create an async validator directive with a custom error key.
      
      import { of } from 'rxjs';
@Directive({
  selector: '[customAsyncValidator]',
  providers: [{provide: NG_ASYNC_VALIDATORS, useExisting: CustomAsyncValidatorDirective, multi:
true}]
})
class CustomAsyncValidatorDirective implements AsyncValidator {
  validate(control: AbstractControl): Observable<ValidationErrors|null> {
    return of({'custom': true});
  }
}