EmailValidator
directive
npm Package | @angular/forms |
---|---|
Module | import { EmailValidator } from '@angular/forms'; |
Source | forms/src/directives/validators.ts |
Overview
@Directive({ selector: '[email][formControlName],[email][formControl],[email][ngModel]', providers: [EMAIL_VALIDATOR] }) class EmailValidator implements Validator { set email: boolean | string validate(c: AbstractControl): ValidationErrors | null registerOnValidatorChange(fn: () => void): void }
Selectors
[email][formControlName]
[email][formControl]
[email][ngModel]
Inputs
email
bound to EmailValidator.email
Description
A Directive that adds the email
validator to controls marked with the email
attribute, via the NG_VALIDATORS
binding.
Example
<input type="email" name="email" ngModel email> <input type="email" name="email" ngModel email="true"> <input type="email" name="email" ngModel [email]="true">
Members
set email: boolean | string
validate(c: AbstractControl): ValidationErrors | null
registerOnValidatorChange(fn: () => void): void
© 2010–2018 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v5.angular.io/api/forms/EmailValidator