1

My following piece of code writes a piece of data to firebase using priorities. This is all great and good. However I want to be able to arrange my list in reverse priority order? I understand that FB treats ordering as lowest first and higher further down the list... is there anyway of reversing this?

newMessageRef.setWithPriority({
  'message': $scope.place.name + " has been edited",
  'updated': $scope.place.updated,
  'userid': Auth.signedInAs().id}, $scope.place.updated);

EDIT - I know I can add a custom "reverse" filter to my ng-repeat which does work but you can briefly see the "shuffle" taking place. Would be great to arrange the data at source in the order of most recently added/edited items at the top. Almost the opposite to doing an array style .push()

3
  • 2
    You can't reverse the results yet. See this thread for more details
    – Riron
    May 28, 2014 at 14:42
  • 1
    Hey Nick! Is there some reason you can't just put a - in front of the value to reverse them? E.g. 5 becomes -5, et al. You can also use endAt().limit(x) to grab the last x records (i.e. the highest prorities). Do either of those help?
    – Kato
    Jun 5, 2014 at 5:03
  • @Kato - I tried that and at the time it didn't work. May give it another go :-)
    – Nick Lewis
    Jun 6, 2014 at 14:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.