I encountered an issue with creating a user account using Ionic Framework and Firebase. Oddly, the email box returns 'undefined' while the password box functions correctly despite being coded in a similar manner. Below is my HTML snippet:
<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>
Below is the controller class, which is invoked when the form is 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);
};
Upon inspection, the first console log always displays 'Email: undefined', while the second one reflects the correct password input. This discrepancy causes the call to Settings.createUser to fail due to the 'undefined' email value.
What could be causing this issue?
Appreciate any help!