Reputation: 2454
AngularJS docs (https://docs.angularjs.org/api/ng/filter/filter) have a very clear example how to use their filter together with a comparator so that you can do exact match by setting :true on the filter
ng-repeat="task in tasks | filter:search:true
The problem is that i am searching on the search object (as per their example) and one of the search filters is a free text search. How can i get the strict search to apply to my other search filters but NOT to my free text search.
So to stick with their example. Looking at the following
<label>Any: <input ng-model="search.$"></label> <br>
<label>Name only <input ng-model="search.name"></label><br>
<label>Phone only <input ng-model="search.phone"></label><br>
How can I get strict filtering to apply to search.name and search.phone but NOT to search.$
Note: In my code I dont have search.name and search.phone as text inputs but rather as dropdown selections which is why i want them to be strict.
Please advise Thanks
Upvotes: 0
Views: 624
Reputation: 9486
Apply several filters:
ng-repeat="task in tasks | filter:{'$' : search.$} | filter:{'phone' : search.phone}:true | filter:{'name' : search.phone}:true
Make your own filter:
ng-repeat="task in tasks | myfilter:search app.filter('myfilter')
Upvotes: 1