Reputation: 3137
Hi I need to filter an angular list based on a child property.
I have this model:
$scope.data = [{name:"John",type:{talent:"genius"}},
{name:"Paul",type:{talent:"genius"}},
{name:"Ringo",type:{talent:"lucky"}}];
I need to display a list of name of only talented people. So I was trying something like this:
item in data|myFilter:item.type
http://jsbin.com/ObIqUyix/1/edit
Upvotes: 15
Views: 9028
Reputation: 13399
This is better because it'll let you have other properties in the type object as well and you can still filter using different properties:
item in data | filter: {type:{talent:'genius'}}:true
Upvotes: 37