angularjs - It it possible to order an array of objects by an array element? -
if have array this:
[ {names: [ {firstname: "bob", lastname: "jones"}, {firstname: "martha", lastname: "jones"} ] }, {names: [ {firstname: "jim", lastname: "franklin"}, {firstname: "jill", lastname: "franklin"} ] } ]
what expression use in ng-repeat order first lastname of each record (e.g. names[0].lastname)?
use:
ng-repeat="e in entries | orderby:'names[0].lastname'"
or:
ng-repeat="e in entries | orderby:'-names[0].lastname'"
for reverse order.
Comments
Post a Comment