Given a controller with a $scope property that is an object with other properties rather than an array like below, how should I filter the ng-repeat
set?
I made an example on how to not change your object to an Array. I think this answers the question more correct.
I had the same problem that i could not search in a Object.
http://jsbin.com/acagag/223/edit
angular.module('filters',['utils'])
.filter('friendFilter', function(utils){
return function(input, query){
if(!query) return input;
var result = {};
angular.forEach(input, function(friendData, friend){
if(utils.compareStr(friend, query) ||
utils.compareStr(friendData.phone, query))
result[friend] = friendData;
});
return result;
};
});
So just instead of returning a array you return a object.
Hope this helps someone!