Create a custom filter:
filter('and', function($log) {
return function(items, query) {
if (!query) return items; // return all items if nothing in query box
var terms = query.split(' '); //split query terms by space character
var arrayToReturn = [];
items.forEach(function(item){ // iterate through array of items
var passTest = true;
terms.forEach(function(term){ // iterate through terms found in query box
// if any terms aren't found, passTest is set to and remains false
passTest = passTest && (item.toLowerCase().indexOf(term.toLowerCase()) > -1);
});
// Add item to return array only if passTest is true -- all search terms were found in item
if (passTest) { arrayToReturn.push(item); }
});
return arrayToReturn;
}
})
and use it in place of filter: query
:
<tr ng-repeat="thing in blah | and:query">