0

I have a table built with ng-repeat this way:

  <tr ng-repeat="book in books | filter:searchText | orderBy: 'title'">
    <td>{{book.author}}</td>
    <td>{{book.title}}</td>
    <td>{{book.editor}}</td>
  </tr>

And books is an object which has more properties than the ones shown in the table. The research is simply implemented this way:

<label>Search: <input ng-model="searchText"/></label>

Now, what I need to do is apply the search filter ONLY to those data fields which are shown in the table. For example: let's suppose my data source books has these fields: title, author, editor, year, isbn, description. As it is now, if I type some words in the search input, the results are filtered considering ALL those fields, so I could visualize also some books containing that word in their description, resulting in some unclear search (the user has searched a word but can not see it in the results).

How can I apply the research only to the shown fields (I don't want to delete the unshown fields because I need them for other functions)?

prtnkl
  • 302
  • 1
  • 4
  • 12
  • may be help u http://stackoverflow.com/questions/20849804/filter-by-multiple-columns-with-ng-repeat – Hadi J Mar 02 '16 at 13:26
  • this post may help you: http://stackoverflow.com/questions/29273567/angular-filters-how-to-pre-filter-so-angular-filters-consider-only-a-partial-of/29274535#29274535 – Aliz Mar 02 '16 at 13:32
  • It looks like the answers on these questions are about filtering with an `AND` query (meaning if I search "a", it will filter for results that have an "a" on each field). What I need to do is filtering with an `OR` query (the results have an "a" in their title, author or editor, or two or three of them). – prtnkl Mar 02 '16 at 14:11
  • You can easily adapt the solutions provided to do what you need. – Aliz Mar 02 '16 at 14:21

0 Answers0