AngularFire 曾经有一个 orderByPriority 过滤器 [英] AngularFire used to have a orderByPriority filter

查看:23
本文介绍了AngularFire 曾经有一个 orderByPriority 过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从 Google 的结果来看,AngularFire 过去似乎有一个 orderByPriority 过滤器.但我在当前的 AngularFire api 文档中找不到这个:https://www.firebase.com/docs/web/libraries/angular/api.html.据我了解,orderByPriority 将对象属性转换为数组.我想这个过滤器已经消失了,因为现在有另一种更好的方法来做,但那个方法是什么?

From Google result it looks like AngularFire used to have a orderByPriority filter. But I cannot find this in the current AngularFire api docs: https://www.firebase.com/docs/web/libraries/angular/api.html. As I understand it, orderByPriority converted an objects properties into to an array. I guess this filter is gone because there is another and better way to do it now, but what is that method?

推荐答案

不再需要 orderByPriority,因为您可以使用已经隐式排序的同步数组.

There is no longer a need for orderByPriority since you can utilize a synchronized array, which is already implicitly ordered.

所以在古代,你会做这样的事情:

So in ancient days, you would do something like:

$scope.data = $firebase(ref);

<div ng-repeat="item in data | orderByPriority" />

在不那么古老的时代(即 0.8.x 或更高版本),您只需选择一种数组格式:

In not so ancient times (i.e. 0.8.x or greater) you would simply choose an array format:

$scope.data = $firebase(ref).$asArray();

<div ng-repeat="item in data" />

这篇关于AngularFire 曾经有一个 orderByPriority 过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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