Another weird one for today. I am creating a registration form in angularjs, the form sits inside a view folder called register.html. It is retrieved and displayed the ng-view in the homepage.
The controller is also so set in a separate file with various other controllers. The big problem for me is that I am unable to create a register function as angular fire keeps throwing my this error:
$createUser() expects an object containing 'email' and 'password', but got a string.
This is crazy because in my function both are variables:
//Register controller
controllersModule.controller("RegCtrl", ["$scope", "$firebaseAuth",
function($scope, $firebaseAuth){
var ref = new Firebase("https://<MY APP>.firebaseio.com");
var auth = $firebaseAuth(ref);
$scope.signUp = function() {
if (!$scope.regForm.$invalid) {
var email = $scope.user.email;
var password = $scope.user.password;
if (email && password) {
auth.$createUser(email, password)
.then(function() {
// do things if success
console.log('User creation success');
}, function(error) {
// do things if failure
console.log(error);
console.log('something is not right');
$scope.regErrorMessage = error.message;
});
}
}
};
}]);
//.End Register controller
The form also specifies the type of data they are:
<input type="password" name="password" class="form-control" ng-model="user.password" ng-minlength="8">
<input type="email" name="email" class="form-control" ng-model="user.email">
I really do not understand what this error means and can't think of any more ways to specify email and password. Can someone please help?