Niculescu Bogdan
Niculescu Bogdan

Reputation: 17

Angularfire 2 query equalTo object

I am trying to filter data from firebase query based on some labels

My data is structured like this

And i tried to use this firebase feature: The Firebase SDK supports an optional key parameter for startAt, endAt, and equalTo when ordering by child, value, or priority. You can specify the key parameter using an object literal that contains the value and the key. For example: startAt: { value: 'some-value', key: 'some-key' }.

But I am getting this error: ERROR Error: Query: First argument passed to startAt(), endAt(), or equalTo() cannot be an object.

Upvotes: 1

Views: 1270

Answers (1)

Willian Krause
Willian Krause

Reputation: 52

I was able to do something like this:

af.database.list(path, { query: { orderByChild: 'labels/' + label, equalTo: true } });

where the label variable is the label name I want to query.

Upvotes: 1

Related Questions