EmailValidator
directive
A directive that adds the email
validator to controls marked with the
email
attribute. The directive is provided with the NG_VALIDATORS
multi-provider list.
string | boolean
Tracks changes to the email attribute bound to this directive.
enabled
boolean
@paraminput
boolean
@returns
boolean
ngOnChanges
void
@returns
void
validate
ValidationErrors | null
@returns
ValidationErrors | null
registerOnValidatorChange
void
@paramfn
() => void
@returns
void
Description
A directive that adds the email
validator to controls marked with the
email
attribute. The directive is provided with the NG_VALIDATORS
multi-provider list.
The email validation is based on the WHATWG HTML specification with some enhancements to incorporate more RFC rules. More information can be found on the Validators.email page.
Exported by
Usage Notes
Adding an email validator
The following example shows how to add an email validator to an input attached to an ngModel binding.
<input type="email" name="email" ngModel email><input type="email" name="email" ngModel email="true"><input type="email" name="email" ngModel [email]="true">
Jump to details