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.