W3cubDocs

/Angular 12

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.

See also

Exported from

Selectors

Properties

Property Description
@Input()email: string | boolean Write-Only

Tracks changes to the email attribute bound to this directive.

Description

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">

© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v12.angular.io/api/forms/EmailValidator