2
    subscribeQueryPostsByUsernameAndCategory(username: string, category: string) {
    return  this.af.database.list('posts', {
        query: {
            orderByChild: 'username',
            equalTo: username,
        }
    });

Now each post object has a username and a category property. I want to be able to get all the posts of a specific username and category.

How can I either had a filter for the category or just assign the return to a variable and do some kind of loop to check the property before returning?

Thanks

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
John
  • 855
  • 1
  • 7
  • 6
  • Use rxjs filters. – Manish Nov 21 '16 at 09:12
  • 1
    The Firebase Database can only order by/filter on a single property. You may be able to combine the two values into a single property to accomplish your use-case. See http://stackoverflow.com/questions/26700924/query-based-on-multiple-where-clauses-in-firebase. I also recommend checking out this video, which covers the same approach: https://www.youtube.com/watch?v=sKFLI5FOOHs&index=4&list=PLl-K7zZEsYLlP-k-RKFa7RyNPa9_wCH2s – Frank van Puffelen Nov 21 '16 at 16:12

0 Answers0