Angularjs orderBy基于多个选择菜单

时间:2016-01-09 20:21:25

标签: angularjs

我想根据多个选择菜单制作orderBy。例如:

Order : 
<select ng-model="filterOrder">
    <option value="+">- to +</option>
    <option value="-">+ to -</option>
</select>

Column: 
<select ng-model="filterColumn">
    <option value="name">Name</option>
    <option value="age">Age</option>
</select>

<div ng-repeat="user in users|orderBy:'filterOrder.filterColumn'">
        {{user.name}} {{user.age}}  <br>
</div>         

谢谢!

1 个答案:

答案 0 :(得分:1)

您想使用reverse

orderBy参数
<div ng-repeat="user in users|orderBy:filterColumn: filterOrder == '-'">

表达式filterOrder == '-'将返回该参数的布尔值