对于一个纯粹的火力地堡的JavaScript API一个排序依据对象过滤器 [英] A orderby object filter for a pure Firebase JavaScript API

查看:153
本文介绍了对于一个纯粹的火力地堡的JavaScript API一个排序依据对象过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现 angularFire 结合与纯火力地堡的JavaScript API使用时,总是困惑我。

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

比方说,我不知道如何调用火力地堡datasapshot API ss.name() ss.hasChild(),ss.forEach ()等在angularFire。

Let's say I have no idea how to call the Firebase datasapshot API ss.name(), ss.hasChild(), ss.forEach() etc in angularFire.

所以,我决定独自使用火力地堡的JavaScript API,因为我意识到它已经有双向数据绑定(显式)与AngularJS不使用angularFire。

So I decide to use the Firebase JavaScript API alone because I realized it already has two-way data binding (explicit) with AngularJS without using angularFire.

演示没有ngFire

但我得到的 NG-重复问题。返回的数据是一个对象,所以我不能排序。后来我发现这个 orderByObject 过滤器,但一旦转换为阵,我就失去了对象键。

But I got a problem with the ng-repeat. The returned data is an object so I cannot sort. Then I found this orderByObject filter, but once converted to array, I would lose the object key.

能否火力地堡团队帮助我提高这个orderByObject过滤器来支持对象键?

Can the Firebase team help me to improve this orderByObject filter to support the object key?

推荐答案

您可以使用 orderByPriority 转换火力对象到数组,然后应用正常过滤和排序依据。

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>

这篇关于对于一个纯粹的火力地堡的JavaScript API一个排序依据对象过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆