I\'m an AngularJS newbie and I\'m building up a small proof-of-concept car hire listings app that pulls in some JSON and renders out various bits of that data via an ng-repe
If you still want a custom filter you can pass in the search model to the filter:
Where definition for the cartypefilter can look like this:
app.filter('cartypefilter', function() {
return function(items, search) {
if (!search) {
return items;
}
var carType = search.carType;
if (!carType || '' === carType) {
return items;
}
return items.filter(function(element, index, array) {
return element.carType.name === search.carType;
});
};
});
http://plnkr.co/edit/kBcUIayO8tQsTTjTA2vO?p=preview