如果我有这样的数组:
[ {names: [ {firstName: "Bob", lastName: "Jones"}, {firstName: "Martha", lastName: "Jones"} ] }, {names: [ {firstName: "Jim", lastName: "Franklin"}, {firstName: "Jill", lastName: "Franklin"} ] } ]
我在ng-repeat中使用什么表达式来按每个记录的第一个lastName排序(例如names [0] .lastName)?
答案 0 :(得分:0)
使用:
ng-repeat="e in entries | orderBy:'names[0].lastName'"
或:
ng-repeat="e in entries | orderBy:'-names[0].lastName'"
用于逆序。