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

问题描述

从谷歌得到它看起来像AngularFire曾经有一个orderByPriority过滤器。 。据我了解,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.4或更高版本),你会简单地选择一个阵列格式为:

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过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 16:15