1

Why does Angulars' form validation always report that an email address such as a@a is valid?

I know its possible to provide a regex as a work around but I do not understand how or why Angular considers this a valid email address.

Edit: I have novalidate specified in the form tag which should bypass any html5 validation

4 Answers 4

2

Why do you think a@a is not a valid email address?

I understand the desire to check whether the domain part of an email address is a TLD, but that list is growing. So it seems unwise to build that sort of restriction into your application unless you will be diligent about keeping your TLD data up-to-date.

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

5 Comments

About half way down on that wiki page: admin@mailserver1 (local domain name with no TLD) that answers my question. I still think local email addresses should be considered invalid. Just my opinion.
Did you read the second part of my answer suggesting why that would be difficult to achieve?
Yes but I wouldn'nt validate all TLD names, just the patterns eg. .xx to .xxxx or which ever range is valid.
Dotless domains are valid RFC822, but dotless domains are not allowed to be used for email any more, so they should be considered invalid.
2

There are things other than RFCs that define email addresses. In August 2013, ICANN banned the use of 'dotless' domains, with the support of just about everyone (including Microsoft, Yahoo, AOL, Apple and Google) after a long consultation. So while dotless domains in email are valid RFC822 (because they are classed as local aliases, which are not valid internet names), they are not valid to use for other reasons, and so you should indeed reject them at source, and angular is wrong to accept them.

Incidentally I wrote the HTML5 definition of email addresses with this in mind.

Comments

1

a@a is a valid email address according to RFC 5322

Comments

0

its not about angularjs validation on email. its validate by html5

<input type="email" ng-model="email" required> // this is validate by `html5` if you'r not add a custom validation to it.

difference of using novalidate. see the Plunker

first one is not using novalidate and second one is using it.

clear the input field and submit the form. the form without novalidate will show the native html5 email validation error, while form with novalidate will not showing the html5 validation error.

2 Comments

I have novalidate specified in my form tag which should bypass the html5 validation.
novalidate is used to disable browser's native form validation. means it diable the validation messages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.