I\'m using custom async validator with Angular 4 reactive forms to check if E-Mail address is already taken by calling a backend.
However, Angular calls the validato
I think your method only delay, not debounce, then find the sample way to archive this result.
import { debounce } from 'lodash';
...
constructor() {
this.debounceValidate = debounce(this.debounceValidate.bind(this), 1000);
}
debounceValidate(control, resolve) {
...//your validator
}
validate (control: AbstractControl): Promise {
return new Promise(resolve => {
this.debounceValidate(control, resolve);
})
}