Async Validators
Validate against the server asynchronously.
Validation That Waits
Some validation needs a server, such as checking if a username is taken. Async validators return a Promise or Observable that resolves to an error map or null.
The AsyncValidatorFn Type
An async validator takes a control and returns Observable<ValidationErrors | null> (or a Promise).
const v: AsyncValidatorFn = (control) => {
return checkAvailable(control.value);
};