如何获得在火力地堡和角度特定元素和排序依据优先级 [英] How to get specific element and orderby priority in Firebase and Angular
本文介绍了如何获得在火力地堡和角度特定元素和排序依据优先级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个火力点参考这样的:
I have a firebase reference like this:
$scope.lessons = $firebaseArray(firebase.child('Lessons').orderByChild('courseID').equalTo($state.params.courseID));
我输出的教训是这样的:
I'm outputting the lessons like this:
<ul>
<li class="lesson" ng-if="lesson.moduleID == module.$id" ng-repeat="lesson in lessons" lessonid="{{lesson.$id}}">
<lessonedit></lessonedit>
</li>
</ul>
我需要按优先级的教训,但是当我加入orderByPriority()函数将火力的末尾引用它说,我只能用一个排序依据的呼叫。
I need to order the lessons by priority, but when I add the orderByPriority() function to the end of the firebase reference it says I can only use one orderBy call.
我试过的过滤器教训教训| orderByPriority
,但它说,过滤器不存在?
I tried the filter lesson in lessons | orderByPriority
but it says that filter does not exist?
推荐答案
如果优先级
是课的一个属性,您可以使用角过滤器的 排序依据
是这样的:
If Priority
is an attribute of lesson, you can use the angular filter orderBy
like this:
<ul>
<li class="lesson"
ng-if="lesson.moduleID == module.$id"
ng-repeat="lesson in lessons | orderBy:'Priority'"
lessonid="{{lesson.$id}}">
<lessonedit></lessonedit>
</li>
</ul>
这篇关于如何获得在火力地堡和角度特定元素和排序依据优先级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文