0

How would one join collections with Firebase and then later use it in an angular repeat?

Heres my database structure in Firebase:

enter image description here

I want to join wishes with the appropriated list and listId - but how?

And would I be able to do as such?:

<ul>
    <li ng-repeat="list in lists">{{list.listName}}

        <ul>
            <li ng-repeat="wish in lists.wishes">{{wish.itemName}}</li>
        </ul>
    </li>
</ul>

Hope thing make sense!

aventic
  • 1,494
  • 2
  • 16
  • 23
  • You'd have to write code to do that join in your controller. Keep in mind that Firebase is a NoSQL database, where denormalizing data for easier/faster retrieval is quite common. See my answer to this question: http://stackoverflow.com/questions/16638660/firebase-data-structure-and-url/16651115#16651115 and this blog post: https://www.firebase.com/blog/2013-04-12-denormalizing-is-normal.html – Frank van Puffelen Apr 09 '15 at 15:37

1 Answers1

0

You could try below snippet.

<ul>
    <li ng-repeat="list in lists">{{list.listName}}

        <ul>
            <div ng-repeat="wish in lists.wishes">
               <li>{{wish.itemName}}</li>
               <li>{{list.listId}}</li>
            <div>
        </ul>
    </li>
</ul>

<div> inside ul is not allowed but in HTML5 it will work without breaking anything, Refer Link

Pankaj Parkar
  • 134,766
  • 23
  • 234
  • 299
  • My question is more; how to I join collections with Firebase so I can output it like that, into an angular repeat. – aventic Apr 09 '15 at 17:21