我在一个页面上有大约四个可以排序的主要 div(至少它们是通过 jQuery 进行的),我已经通过在 orderBy 条件中的管道将它们转换为 NG 排序并将其绑定到 ng-click。它适用于第一个组,但是当我尝试第二组时,它向我咆哮,因为 orderBy 的命名空间没有被绑定,所以我假设改变它的排序依据是不够的。
现在,我在 ng-repeat 中填充了一些日期:
<li ng-repeat="condition in signConditions" | orderBy:orderByField:reverseSort">
当用户单击此处的链接时对其进行排序:
<a href="javascript:void(0)" ng-click="orderByField='title'; reverseSort = !reverseSort" class="titleLabel">Documents <span ng-show="orderByField == 'title'"><span ng-show="!reverseSort">^</span><span ng-show="reverseSort">v</span></span></a>
在我的控制器中,我在这里有一个简单的范围绑定:
$scope.orderByField = 'conditionId';
$scope.reverseSort = false;
所以这一直有效,直到我尝试再次执行此操作,我需要为页面上的四个单独的组至少执行四次。
因此,每个新的 ling-repeat 将是: blahConditions 中的条件 blipConditions 中的条件等...
所以我的问题是如何将每个 orderBy 绑定到它的特定组?
任何建议表示赞赏。