cr-connect-bpmn/src/app/_forms/validators/email.validator.ts

10 lines
346 B
TypeScript

import { AbstractControl, ValidationErrors } from '@angular/forms';
import EMAIL_REGEX from './email.regex';
export function ValidateEmail(control: AbstractControl): ValidationErrors {
if (!EMAIL_REGEX.test(control.value) && control.value && control.value !== '') {
const error: ValidationErrors = { email: true };
return error;
}
}