This is the archived documentation for Angular v6. Please visit angular.io to see documentation for the current version of Angular.

EmailValidator

A Directive that adds the email validator to controls marked with the email attribute, via the NG_VALIDATORS binding.

NgModules

Selectors

Properties

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

Description

Example

<input type="email" name="email" ngModel email> <input type="email" name="email" ngModel email="true"> <input type="email" name="email" ngModel [email]="true">
      
      <input type="email" name="email" ngModel email>
<input type="email" name="email" ngModel email="true">
<input type="email" name="email" ngModel [email]="true">
    

Methods

validate(control: AbstractControl): ValidationErrors | null
      
      validate(control: AbstractControl): ValidationErrors | null
    

Parameters

control

Type: AbstractControl.

Returns

ValidationErrors | null

registerOnValidatorChange(fn: () => void): void
      
      registerOnValidatorChange(fn: () => void): void
    

Parameters

fn

Type: () => void.

Returns

void