Reputation: 11
I have a problem with my filter function in my Angular JS project. This is my code:
<div class="tree-folder">
<div ng-repeat="catalog in ListCatalogData | filter:TextSearchTree" ng-include="'treeItem'"></div>
</div>
It working very well with all character except '!'. I need help!
Upvotes: 1
Views: 70
Reputation: 6734
In angular filter documentation:
The string is used for matching against the contents of the array. All strings or objects with string properties in array that match this string will be returned. This also applies to nested object properties. The predicate can be negated by prefixing the string with !.
So if you have to search '!' you need write new filter like:
app.filter('wordsFilter', function() {
return function(items, word) {
var filtered = [];
angular.forEach(items, function(item) {
if(item.indexOf(word) !== -1){
filtered.push(item);
}
});
return filtered;
};
});
Upvotes: 1