Tropicalista
Tropicalista

Reputation: 3137

Angularjs orderBy child property

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

Upvotes: 8

Views: 4188

Answers (1)

dumbexpert
dumbexpert

Reputation: 166

item in data|orderBy:'type.val'

Upvotes: 15

Related Questions