0
내 응용 프로그램이 firebase 인증을 사용하도록하려고합니다 .. 이 단계에서 로그인 컨트롤러가 성공적으로 로그인되었지만 로그인하면 다음 로그 아웃됩니다.
.service('userAuth', ["$firebaseAuth", function($firebaseAuth) {
return $firebaseAuth();
}
은 무엇 인증 상태 그래서 나는 내 사이트를 통해 사용할 수 있습니다에 대한 더 좋은 방법이 될 것입니다 :
.controller('LoginCtrl', function ($scope, $location, userAuth) {
if ($scope.authData) {
console.log("User " + authData.uid + " is logged in with " + authData.provider);
} else {
console.log("User is logged out");
}
$scope.login = function() {
$scope.authData = null;
$scope.error = null;
userAuth.$signInWithEmailAndPassword($scope.loginemail, $scope.loginpassword)
.then(function(authData) {
$scope.authData = authData;
console.log(authData);
$location.path('/home');
$scope.$apply();
}).catch(function(error) {
$scope.error = error.message;
});
};
});
나는 내 중포 기지 객체를 얻을 서비스를?
은 내가 $ onAuth를 사용하여 시도하지만 난이 오류를
TypeError: Cannot read property '$onAuth' of undefined