Der Versuch, einen Benutzer mit Firebase zu authentifizieren. Starte meine App mit Firebase 2.xx, aber selbst nach dem Upgrade auf Firebase 3.xx, werfen Fehler "OnAuthStateChanged ist keine Funktion". DieseOn Auth State geändert AngularFire
ist, wie meine Login-Funktion sieht wie-
.controller('HomeCtrl', ['$scope','$location','CommonProp','$firebaseAuth', '$firebaseObject',function($scope,$location,CommonProp,$firebaseAuth,$firebaseObject) {
var firebaseObj = $firebaseObject(rootRef);
var loginObj = $firebaseAuth(firebaseObj);
$scope.SignIn = function($scope, user) {
event.preventDefault(); // To prevent form refresh
var username = user.email;
var password = user.password;
loginObj.$signInWithEmailAndPassword({
email: username,
password: password
})
.then(function(user) {
// Success callback
console.log('Authentication successful');
$location.path("/welcome");
CommonProp.setUser(user.password.email);
}, function(error) {
// Failure callback
console.log(error);
});
}
}]);