Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angularjs orderBy child property

Tags:

angularjs

Hi I need to order an angular list based on a child property.

I have this model:

  $scope.data = [{name:"John",type:{talent:"genius",val:99}},
                 {name:"Paul",type:{talent:"genius",val:89}},
                 {name:"Ringo",type:{talent:"lucky",val:29}}];

I need to display a list of name of only talented people. So I was trying something like this:

item in data|orderBy:{type.val}

http://jsbin.com/ObIqUyix/4/edit

like image 208
Tropicalista Avatar asked Dec 14 '13 15:12

Tropicalista


1 Answers

item in data|orderBy:'type.val'
like image 102
dumbexpert Avatar answered Nov 16 '22 01:11

dumbexpert