Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angularfirecollection return object instead of array

Before using angularFireCollection() I was using angularFire(). But angularFire listening on value instead of childs so someone suggest me to use angularFireCollection.

But now angularFireCollection return arrays. =.=

So any idea in this situation?

I want my data return in objects and listening on childs.

like image 534
vzhen Avatar asked Dec 18 '25 20:12

vzhen


1 Answers

To access the key names from the array returned by angularFireCollection, you can use the $id property:

<ul>
  <li ng-repeat="item in items">{{item.$id}}: {{item.val}}</li>
</ul>
<script>
  $scope.items = angularFireCollection(new Firebase(url));
</script>
like image 59
Anant Avatar answered Dec 22 '25 09:12

Anant



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!