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.
[email][formControlName]
[email][formControl]
[email][ngModel]
Property | Description |
---|---|
@Input()email: boolean | string | Tracks changes to the email attribute bound to this directive. |
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.
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">
© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/forms/EmailValidator