I use Angular (1.3.5) and Firebase to write a toy blog program, and I'm currently struggling with the login part.
First I created an Angular module:
var blogApp = angular.module('blogApp', ['ngRoute', 'firebase', 'RegistrationController']);
Then on top of blogApp, I created a controller called ** RegistrationController **:
blogApp.controller('RegistrationController', function ($scope, $firebaseAuth, $location) {
var ref = new Firebase('https://myAppName.firebaseio.com');
$scope.login = function(){
ref.authWithPassword({
email: $scope.user.email,
password: $scope.user.password
}, function(err, authData) {
if (err) {
$scope.message = 'login error';
} else {
$scope.message = 'login sucessful!';
}
});
};
});
I attached the method login()to ng-submit in my user login form in the scope RegistratinController.
When I click to submit the login form, the form does not make any response, without any errors.
The login form only works when I double-click the "Submit" button - why? confusing
source
share