我有一个玩家列表,我试图先按等级排序,然后是玩家名称。这不是我得到的输出。我对orderBy
filter的理解是可以接受一系列表达式。
<li ng-repeat="player in players | orderBy:['player.grade.number','player.first_name']">
{{ player.grade.number }} - {{ player.first_name }}
</li>
http://plnkr.co/edit/h8Dlsmwi2mEqY9XzdRH7?p=preview
$scope.players = [
{
"id":"91",
"first_name":"Steve",
"last_name":"Nickel",
"grade":{
"id":"7",
"number":"7"
}
},
...
答案 0 :(得分:4)
您不必使用player
开始字符串:
<li ng-repeat="player in players | orderBy: ['grade.number','first_name']">