When I use the code below, I am getting the following error:
Provider 'Login' must return a value from $get factory method.
I've reviewed the stackoverflow posts here and here, but can't figure out what I'm doing wrong.
myApp.factory('Login', function($location, $firebaseAuth, Ref, Auth) {
var authData = Ref.getAuth();
if (authData) {console.log('already logged in with ' + authData.uid)} else {
return Auth.$authAnonymously({rememberMe: true}).then(redirect, showError);
function redirect() {
$location.path('/account');
}
function showError(err) {
Login.err = err;
}
}
});