1 import { Validators } from '@angular/forms'
2 import { BuildFormValidator } from './form-validator.model'
4 export const FROM_EMAIL_VALIDATOR: BuildFormValidator = {
5 VALIDATORS: [ Validators.required, Validators.email ],
7 required: $localize`Email is required.`,
8 email: $localize`Email must be valid.`
12 export const FROM_NAME_VALIDATOR: BuildFormValidator = {
15 Validators.minLength(1),
16 Validators.maxLength(120)
19 required: $localize`Your name is required.`,
20 minlength: $localize`Your name must be at least 1 character long.`,
21 maxlength: $localize`Your name cannot be more than 120 characters long.`
25 export const SUBJECT_VALIDATOR: BuildFormValidator = {
28 Validators.minLength(1),
29 Validators.maxLength(120)
32 required: $localize`A subject is required.`,
33 minlength: $localize`The subject must be at least 1 character long.`,
34 maxlength: $localize`The subject cannot be more than 120 characters long.`
38 export const BODY_VALIDATOR: BuildFormValidator = {
41 Validators.minLength(3),
42 Validators.maxLength(5000)
45 required: $localize`A message is required.`,
46 minlength: $localize`The message must be at least 3 characters long.`,
47 maxlength: $localize`The message cannot be more than 5000 characters long.`