I created this check function:
private customValidateField(c: FormControl): any {
return c.value[0] === 'a' ? null : { notValid: true };
}
So, in my reactive form:
constructor(private fb: FormBuilder)
{
this.form = this.fb.group({
field: ['', Validators.required, this.customValidateField],
...
}
}
When I write any character in this field, I get this error:
Error: The expected validator to return a promise or observation.
Any ideas?
source
share