1

I have two email address

example@gmail.com

and

example@somevalue

both the email address are valid when I use the AngularJs validation

<input type="email" ng-model="application.email_id" placeholder="Enter Your Email">

I need to make example@somevalue mail address as false if the address is wrong.

This is the tutorial part of AngularJs email validation: there the validation is true when I inputing the above email address.

Gargaroz
  • 313
  • 9
  • 28
Jenson Raby
  • 769
  • 2
  • 6
  • 26

1 Answers1

4

Use ng-pattern="" with your custom pattern to validate the email. In your controller:

$scope.pattern = /.+\@.+\..+/;

In your HTML:

<input type="email" name="input" ng-model="email.text" ng-pattern="pattern" required>

See the plunker (the example from the angular documentation extended with ng-pattern)

Christoph
  • 1,993
  • 1
  • 25
  • 33