Email input box keep returning undefined

I wrote code to create a user account using Ionic with firebase but for some reason the email box returns an undefined while the password box works fine - they’re both made the almost the same way. Heres my HTML:

<ion-view view-title="Create Account">
<form name="form" novalidate="" ng-submit="createUser(form)">
  <div class="list">
    <label class="item item-input">
      <span class="input-label">Email:</span>
      <input type="text" ng-name = "email" ng-model="form.email" ng-minlength="5" ng-maxlength="20" required>
    </label>

    <div class="error-container">
      <div ng-messages-include="error-list.html"></div>
    </div>

    <label class="item item-input">
      <span class="input-label">Password</span>
      <input type="password" ng-name = "password" ng-model="form.password" ng-minlength="5" ng-maxlength="20" required>
    </label>

    <div class="error-container last-error-container">
        <div ng-messages-include="error-list.html"></div>
    </div>

  </div>
  <button class="button button-full button-positive" type="submit">
      Create Account
    </button>
</form>

Heres the controller class - the view calls this function in the controller when the form gets submitted:

  $scope.createUser = function(form) {
console.log("Email: " + form.email);
console.log(form.password);

var information = {
  email: form.email,
  password: form.password
};
Settings.createUser(form.email, form.password);

};

As you can see I have 2 console.logs. The first one always returns ‘Email: undefined’ the second one returns whatever password I typed in, so the password works but not the email input box. The call to Settings.createUser then proceeds to fail because email is undefined.

What am I missing?

Thanks in advance.

So I discovered something even more weird. To test this I’ve been using my actual email address 'mattang5280@hotmail.com. It had the above behavior and my firebase was returning an error reading:

Firebase.authWithPassword failed: First argument must contain the key “email” with type “string”

But when I tried to do asdf@hotmail.com - it worked!
I tried zxcv@hotmail.com it worked
and also qwert@hotmail.com

For some reason it doesn’t like mattang5280@hotmail.com. I tried MattIsCool@hotmail.com and it doesn’t like that either. So for some reason it likes some inputs and not others…any idea why this is happening?

EDIT: It seems like 9+ characters it throws that error. Less then 9 characters for an email and it works fine. Does anyone know how to fix that? Clearly an email can be more than 9 characters…(not including characters after the @ symbol)

OH it was the ng-maxlength=“20” on my email input box. If the email was more than 20 characters it wouldn’t work and would return undefined. I figured it out!