Deric Lima Deric Lima - 1 year ago 110
AngularJS Question

Email Validation with AngularJS 1.2.0

I'm doing email validation with Angular out of box and works like must be.

<input class="form-control" type="email" placeholder=""
name="email" ng-model="" required/>
<div class="error-block" ng-if="form.$submitted &&$invalid">
<div ng-if="$error.required">Enter the Email Address</div>
<div ng-if="$">Invalid email address.</div>

The problem is that when the user insert a domain with more than 6 characters, Angular complain about it. For instance if I try to use the email
, Angular set the email like Invalid.

But if I set the email
, Angular validate the email without problems.
Do I have some way to extend the regex to more than 6 characters or I need to use

Thanks guys

Answer Source

This behaviour was fixed in angular v1.2.10. You might either have to update to that version or use ng-patter with regular expression from this commit from angular repository.

Also, I'd advise you to look into this article about email regexp checking.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download