1

I have two email address

[email protected]

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.

2
  • What do you mean by "make.. address as false if the address is wrong"? What does "wrong" mean here. Commented Aug 25, 2015 at 7:16
  • @New Dev : it seems to be an invalid email address (xyz@xyz), since it does not have any domain Commented Aug 25, 2015 at 7:27

1 Answer 1

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)

Sign up to request clarification or add additional context in comments.

2 Comments

I think that the right way is to use ng-pattern but i would go for a more complete regex
thank you very much.....its working

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.