Angularfire: Querying lists by ordering

Created on 15 Jul 2016  路  4Comments  路  Source: angular/angularfire

When I use:

af.database.list('/items', {
query: {
orderBy: 'score',
limitToLast: 15
}
});

it does not return ordered items list.
Any issues with angularfire2 ordering?

Most helpful comment

The correct syntax would be

af.database.list('/items', {
query: {
orderByChild: 'score',
limitToLast: 15
}
});

orderBy is part of an older version of Firebase and is only supported by the main firebase library, or well, it used to be until 2.4.2. Idk if they still support it in 3.0+. AngularFire uses orderByChild and that's what you should use.

All 4 comments

The correct syntax would be

af.database.list('/items', {
query: {
orderByChild: 'score',
limitToLast: 15
}
});

orderBy is part of an older version of Firebase and is only supported by the main firebase library, or well, it used to be until 2.4.2. Idk if they still support it in 3.0+. AngularFire uses orderByChild and that's what you should use.

Thanks.
Is there any way that we can use orderBy with 'ascending' and 'descending' in this code of AngularFire?

af.database.list('/items', {
query: {
orderByChild: 'score',
limitToLast: 15
}
});

See #338

Closing due to @lf-alves great work!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StephenFluin picture StephenFluin  路  3Comments

aucevica picture aucevica  路  3Comments

sharomet picture sharomet  路  3Comments

Maistho picture Maistho  路  3Comments

KLiFF2606 picture KLiFF2606  路  3Comments