3

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.

2
  • angularFireCollection returns an array in order to ensure the order of items in it matches the priorities set on the server. You'll get an array of Objects, what specifically are you trying to do that you can't do with arrays but can with objects? Commented Aug 28, 2013 at 17:29
  • The reason I want to use objects is I want to retrieve the keys. You answered it in my previous question. ng-repeat="(key, val) in objects". @Anant Commented Sep 2, 2013 at 10:29

1 Answer 1

1

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.