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

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -