A orderby object filter for a pure Firebase JavaScript API

后端 未结 2 1815
遇见更好的自我
遇见更好的自我 2021-01-12 14:12

I found angularFire is always confusing me when used in conjunction with the pure Firebase JavaScript API.

Let\'s say I have no idea how to call the Fir

相关标签:
2条回答
  • 2021-01-12 14:47

    You can use orderByPriority to convert firebase objects into array and then apply normal filter and orderBy.

     <div ng-repeat="customer in customers | orderByPriority | filter:searchText">
         <span>{{ customer.$id }} </span>
     </div>
    
    0 讨论(0)
  • 2021-01-12 14:57

    Take a look at the orderByPriority filter source code - which converts an object into an array ordered by the Firebase priority: https://github.com/firebase/angularFire/blob/master/angularfire.js#L37

    You can include the key of the object directly in each item in the array by setting a special $key property.

    0 讨论(0)
提交回复
热议问题