Answers for "custom validator"

0

custom validator

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};
}
<>
Posted by: Guest on November-27-2020

Code answers related to "custom validator"

Browse Popular Code Answers by Language