0

I have input:

<input ng-model="email" type="email" id="form-email" name="email" placeholder="Inter email" maxlength="250">

When I enter so long hosting:

fax@test.cooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooom

I have:

$scope.email // undefined
document.getElementById("form-email").value //fax@test.cooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooom

But when I enter

fax@testooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooh.com

I have

$scope.email // fax@testooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooh.com

How to fix this trouble?

1
  • The first long domain is not a valid email adress so angular doesn't get it's value. Commented Mar 3, 2015 at 8:07

2 Answers 2

2

There's nothing wrong with that, the first email is invalid and the second one is valid that's why it is accepted.

Each domain name consists of two parts.

Top Level Domain - A top-level domain (TLD) is the part of the domain name located to the right of the dot. The most common top-level domains are .COM, .NET, and .ORG. Some other popular top-level domains are .BIZ, .INFO, .NAME and .IN etc.

Second Level Domain - . The second-level domain name is the part of the domain name located to the left of the dot. Steps-to-make-your-own-website is the second-level domain name and represents the organization or entity behind the internet. Second Level Domain name must be registered with an Internet Corporation for Assigned Names and Numbers (ICANN)-accredited registrar.

Why is the 1st email invalid?

  • Because it doesn't contain a valid top-level domain.

Here are the list of Internet Top-Level-Domains: https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains

Why is the 2nd email vaild?

  • Cause it contains both valid Top Level and Second Level Domain.
Sign up to request clarification or add additional context in comments.

Comments

0

You can validate email input with the ngPattern directive combined to pattern:

<input type="email"
   ng-model="email"
   id="form-email"
   placeholder="Inter email" 
   maxlength="250"
   name="myeamail"
   pattern="^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+\.[a-zA-Z]{2,6}$"
   >

Comments

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.