1

I want to count the total data in a users profile in my firebase. Therefore I first get the profile as object:

var profile = $firebase(ref.child('profile').child(userId)).$asObject();

Now If I console.log this var there is this object:

enter image description here

I found some solutions to count the object with

console.log(Object.keys(profile));

But this gives me only the count 3. always:

enter image description here

Anyone got a solution how I can get the count of the data stored? There should be age, gender, place, realname, username = 5

m1crdy
  • 1,371
  • 2
  • 25
  • 58
  • Try with profile.$loaded.then(function(data) {console.log(data);}); – Whisher Oct 31 '14 at 08:24
  • you rock. thanks. Post this as an answer and explain a little so i can accept it ;) – m1crdy Oct 31 '14 at 08:31
  • possible duplicate of [Firebase angularfire child.$asObject give properties undefined](http://stackoverflow.com/questions/26604472/firebase-angularfire-child-asobject-give-properties-undefined) – Frank van Puffelen Oct 31 '14 at 13:34

1 Answers1

1

Try with

profile.$loaded.then(function(data) {
    console.log(data);
}); 

Take a look at the first comment in this post

Community
  • 1
  • 1
Whisher
  • 31,320
  • 32
  • 120
  • 201