0

I'm trying to get the data partitioned

Example: I have an array with 10 items, I would like to get 2 in 2

My query:

var listRef = firebase.database().ref('products').orderByPriority().startAt(1)
        .limitToFirst(2);
        var productsPagination = $firebaseArray(listRef);
        return productsPagination;

My idea is to increase startAt.

I have the feeling that orderByPriority is not working, I tested it with orderByKey and it worked. But I need orderByPriority

Gansonic
  • 347
  • 4
  • 15
  • Did you set priorities on the items? Otherwise it won't do anything? Please edit your question to include the [minimal, **complete** code that reproduces the problem](http://stackoverflow.com/help/mcve). Any easy way to do this is to reproduce the problem in a jsbin and then share that link. – Frank van Puffelen Apr 04 '17 at 23:47
  • 1
    Also: I'd recommend against using priorities in any new project. They're not needed anymore and can easily be replaced by named child nodes (and orderByChild), which lead to more readable code.. See http://stackoverflow.com/questions/31577915/what-does-priority-mean-in-firebase/31578297#31578297 – Frank van Puffelen Apr 04 '17 at 23:48

0 Answers0