📅  最后修改于: 2022-03-11 15:01:51.930000             🧑  作者: Mango
<>Copyimport {AbstractControl, ValidatorFn} from '@angular/forms';
export function blue(): ValidatorFn {
return (control: AbstractControl): { [key: string]: any } | null =>
control.value?.toLowerCase() === 'blue'
? null : {wrongColor: control.value};
}