Question : custom validator
Answered by : difficult-dunlin-qc6rlu8gkhpa
import {AbstractControl, ValidatorFn} from '@angular/forms';
export function blue(): ValidatorFn { return (control: AbstractControl): { [key: string]: any } | null => control.value?.toLowerCase() === 'blue' ? null : {wrongColor: control.value};
}
<>
Source : https://indepth.dev/the-best-way-to-implement-custom-validators | Last Update : Fri, 04 Dec 20