Here is the scenario: I have a list of topics, each topic includes posts, and each post is "liked" by a list of users. So my data looks something like this:
"topics": {
"topic1": {
"posts": {
"post1": true,
"post2": true
}
}
},
"posts": {
"post1": {
"title": "An awesome post",
"likes": {
"user1": true
}
},
"post2": {
"title": "An even better post",
"likes": {
"user1": true,
"user2": true
}
}
},
"users": {
"user1": {
"name": "Mr. T",
"email": "t@t.com"
},
"user2": {
"name": "Mr. Hello World",
"email": "hello@world.com"
}
}
I (it seems, I) know how to get all posts on a topic using Firebase.util ( http://firebase.imtqy.com/firebase-util ):
Firebase.util.intersection(
fb.child('topics').child('topic1').child('posts'),
fb.child('posts')
)
But now I would like for each post to contain the names of the users who liked this post. How to do it?
Nothing will likely change, but it all happens in AngularFire.