I have in angular nested object like this. is there way how to filter it for nested property
search.l
Yes, you can, if I understood your example properly.
Depending on the size of your collection it may be better to compute the collection you iterate over in ng-repeat
so that the filter isn't doing it constantly as the model changes.
http://jsfiddle.net/suCWn/
Basically you do something like this, if I understood you correctly:
$scope.search = function (shop) {
if ($scope.selectedCityId === undefined || $scope.selectedCityId.length === 0) {
return true;
}
var found = false;
angular.forEach(shop.locations, function (location) {
if (location.city_id === parseInt($scope.selectedCityId)) {
found = true;
}
});
return found;
};