title: How do I loop through the children of a Firebase instance
body: <p>I want to know how to loop through the children of <code>everyone</code>. I'm using Firebase and AngularJS.</p>
  
  <p>My firebase object looks like:</p>
  
  <p><img src="https://i.stack.imgur.com/ws0bT.png" alt="Firebase Objects"></p>
  
  <p>To me it looks like a dictionary, so from <a href="https://stackoverflow.com/questions/558981/iterating-through-list-of-keys-for-associative-array-in-json">Getting a list of associative array keys</a> I have tried</p>
  
  <pre><code>syncData('everyone').$bind($scope, 'everyone').then(function() {
    var keys = $scope.everyone.$getIndex();
    for (var key in $scope.everyone) {
     console.log("key : " + key + " value : " + $scope.everyone[key]);
    }
  });
  </code></pre>
  
  <p>The log does contain the child objects, but it also includes all the methods. Like so</p>
  
  <pre><code>... Before this line is all the other methods.
  key : $on value : function (a,c){if("loaded"==a&amp;&amp;b._loaded)return b._timeout(function(){c()}),void 0;if(!b._on.hasOwnProperty(a))throw new Error("Invalid event type "+a+" specified");b._on[a].push(c)} controllers.js:58
  key : $off value : function (a,c){if(b._on.hasOwnProperty(a))if(c){var d=b._on[a].indexOf(c);-1!==d&amp;&amp;b._on[a].splice(d,1)}else b._on[a]=[];else b._fRef.off()} controllers.js:58
  key : $auth value : function (a){var c=b._q.defer();return b._fRef.auth(a,function(a,b){null!==a?c.reject(a):c.resolve(b)},function(a){c.reject(a)}),c.promise} controllers.js:58
  key : $getIndex value : function (){return angular.copy(b._index)} controllers.js:58
  key : -JH45WOOAtnZfUZkrJb1 value : [object Object] controllers.js:58
  key : -JH45YdfwptGv3y6UqyV value : [object Object] controllers.js:58
  key : -JH45_zxptV_dmibyGzL value : [object Object] 
  </code></pre>
  
  <p><strong>Is there a way I can get just the children?</strong></p>
  
  <p>I'm doing this because my code was designed to use an array, but Firebase discourage using arrays (for values that multiple people could change). So I'm trying to loop through the firebase dictionary and copy the objects into an array on the client side. So I don't have to change too much of my code.</p>