mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
18 lines
477 B
TypeScript
18 lines
477 B
TypeScript
|
|
import {Component} from '@angular/core';
|
|||
|
|
import {FormControl, Validators} from '@angular/forms';
|
|||
|
|
|
|||
|
|
const EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
|
|||
|
|
|
|||
|
|
@Component({
|
|||
|
|
selector: 'input-errors-example',
|
|||
|
|
templateUrl: 'input-errors-example.html',
|
|||
|
|
styleUrls: ['input-errors-example.css'],
|
|||
|
|
})
|
|||
|
|
export class InputErrorsExample {
|
|||
|
|
|
|||
|
|
emailFormControl = new FormControl('', [
|
|||
|
|
Validators.required,
|
|||
|
|
Validators.pattern(EMAIL_REGEX)]);
|
|||
|
|
|
|||
|
|
}
|