所以我有这个数据库:

javascript - 我需要从$ scope到其他数据库的不同ID中获取最大值-LMLPHP

我需要对那些子ID进行排序(从type1type10),在UI上显示排序后的值,并且id的最大值将是我要放入该$id的新变量(本示例情况下最大的值是84.5,其中的$id名为type2)为sifat="type2"

我应该在新变量中声明它们然后对其进行排序吗?

最佳答案

您必须在客户端上进行排序,但是您可以使用angularfires $firebaseArray至少将所有内容放入数组中:

$firebaseArray(...child('result')).$loaded().then(function(types){
    $scope.types = types;
})


然后排序dom(或您需要的其他任何位置)

<div ng-repeat="type in types | orderBy:'value'"></div>


https://www.firebase.com/docs/web/libraries/angular/api.html#angularfire-firebasearray

关于javascript - 我需要从$ scope到其他数据库的不同ID中获取最大值,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41125710/

10-09 01:21
查看更多