title: EmailAttribute is not validating correctly in a ViewModel from ASP.NET Core
body: <p>This is a field located in my viewmodel:</p>
  
  <pre><code>[Required(ErrorMessage = "Email is missing."), EmailAddress(ErrorMessage = "Email is not valid.")]
  public string Email { get; set; }
  </code></pre>
  
  <p>(<code>EmailAddress</code> is from the <code>EmailAddressAttribute.EmailAddressAttribute()</code> type)<br>
  This is the relevant part from the HTML:</p>
  
  <pre><code>&lt;div&gt;
      &lt;label for="inputEmail"&gt;EMAIL&lt;/label&gt;
      &lt;input id="inputEmail" ng-model="email" asp-for="Email" class="form-control" /&gt;
  &lt;/div&gt;
  &lt;div&gt;
      &lt;span asp-validation-for="Email" class="text-danger"&gt;&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>When I type <code>myemail</code> in the email text box, it will say </p>
  
  <blockquote>
    <p>Email is invalid</p>
  </blockquote>
  
  <p>However, when typing <code>myemail@email</code>, it will be viewed as correct by the view-model (only on the front-end).</p>
  
  <pre><code>public async Task&lt;JsonResult&gt; Register([FromForm]VisitViewModel vm)
  </code></pre>
  
  <p>Casting like this properly puts the <code>ModelState</code> on invalid and rejects the email, so that part is okay.</p>
  
  <p>According to <a href="https://stackoverflow.com/a/16403290/3397436">this answer</a> though, the frontend should indicate this as invalid</p>
  
  <p>Can anybody explain what is happening here? I'm at an absolute loss.</p>