A validator is a function that processes a FormControl or collection of controls and returns an error map or null. A null map means that validation has passed.
Validator that requires the control's value to be greater than or equal to the provided number. The validator exists only as a function and not as a directive.
Validator that requires the control's value to be less than or equal to the provided number. The validator exists only as a function and not as a directive.
ValidationErrors | null: An error map with the email property if the validation check fails, otherwise null.
Tests the value using a regular expression pattern suitable for common usecases. The pattern is based on the definition of a valid email address in the WHATWG HTML specification with some enhancements to incorporate more RFC rules (such as rules related to domain names and the lengths of different parts of the address).
The differences from the WHATWG version include:
Disallow local-part (the part before the @ symbol) to begin or end with a period (.).
Disallow local-part to be longer than 64 characters.
Disallow the whole address to be longer than 254 characters.
If this pattern does not satisfy your business needs, you can use Validators.pattern() to validate the value against a different pattern.
Validator that requires the length of the control's value to be greater than or equal to the provided minimum length. This validator is also provided by default if you use the the HTML5 minlength attribute.
Validator that requires the length of the control's value to be less than or equal to the provided maximum length. This validator is also provided by default if you use the the HTML5 maxlength attribute.
Validator that requires the control's value to match a regex pattern. This validator is also provided by default if you use the HTML5 pattern attribute.
A regular expression to be used as is to test the values, or a string. If a string is passed, the ^ character is prepended and the $ character is appended to the provided string (if not already present), and the resulting regular expression is used to test the values.
AsyncValidatorFn | null: A validator function that returns an error map with the merged error objects of the async validators if the validation check fails, otherwise null.