uksz
uksz

Reputation: 18719

Regex pattern doesnt work

I have an issue with Validators.pattern with a following regex:

/^[_a-z0-9]+([_a-z0-9]+)*@[a-z0-9-]+([a-z0-9-]+)*([a-z]{2,4})$/

which should verify email address. You can check out the plnkr. If you delete Validators.pattern(..), the form will work.

Any ideas?

Upvotes: 0

Views: 1214

Answers (2)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 658205

Probably because pattern wasn't yet avaliable in beta.37 which you're using in your Plunker.

ORIGINAL EXCEPTION: TypeError: angular2_1.Validators.pattern is not a function

Working Plunker

Upvotes: 1

LambethWalk
LambethWalk

Reputation: 96

Why not use the built-in email validation:

<input name="myInput" ng-model="myInput" type="email">

See http://www.w3schools.com/angular/angular_validation.asp

Upvotes: 1

Related Questions