问题描述:

I'd like to make orderBy based on multiple select menu. for example:

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>

Thanks!

网友答案:

You want to use the reverse argument of orderBy

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

The expression filterOrder == '-' will return a boolean for that argument

相关阅读:
Top