grautur
grautur

Reputation: 1

AngularFire shows user object as null

I've got an AngularFire app and I'm trying to access the user object that is returned with the $firebaseSimpleLogin factory. Here's the code:

var ref = new Firebase('https://[myfirebase].firebaseio.com');
var loginObj = $firebaseSimpleLogin(ref);
var user = loginObj.user;

When I console.log the loginObj it shows that the user property is indeed an object with all the information I need but the user variable somehow becomes null. Am I doing something wrong here?

Upvotes: 0

Views: 91

Answers (1)

Anant
Anant

Reputation: 7428

The user object will be null until you actually log the user in. You can do so using the $login method, for example:

loginObj.$login('facebook');

If the login succeeds, loginObj will be updated and the user property should point to the logged in user.

Upvotes: 1

Related Questions