0

I want to filter some data from the FirebaseListObservable but I don't know how to perform it. For the normal case here is the solution but using the real time database it doesn't work. Please help.

2
  • In that case just use this Search filter. You will get the expected result. But if not then whatever you have tried just post it here Commented Apr 21, 2017 at 5:07
  • i fetch my data from the database like this *ngFor="let pos of post | async" it works but i want to make some filter by search bar i added the filter pipe like this *ngFor="let pos of post | async | searchFilter: search.value " but it doesnt work Commented Apr 21, 2017 at 14:04

1 Answer 1

1

It is very ineffective to make a query for the whole list and filter it on client side. You need to make a query with parameters, so you will get only needed data in your subscription. Example is below, different query parameters can be inserted to query object. More info about query parameters can be found here: https://firebase.google.com/docs/reference/js/firebase.database.Query

export class AppComponent {
  constructor(af: AngularFire) {
    let listWithQuery = af.database.list('/items', {
      query: {
       equalTo: 'something',
       orderByKey: true
     }
    });
  }
}
Sign up to request clarification or add additional context in comments.

1 Comment

equalTo don't give everything that is included in the search bar , it just give the same exact word of the key value in the database but in my case i wanna to search in all the collection

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.