如何获得在火力地堡和角度特定元素和排序依据优先级地堡、优先级、火力、如何获得

2023-09-13 05:16:58 作者:我揽不住要走的风

我有一个火力点参考这样的:

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>