Reputation: 13
What I'm trying to do is very simple. I want to filter the data in my table by typing the filter value in an input field. I am trying to link the input field to a specific value in the table.
This is the code for my input fields:
<div class="form-group col-xs-6">
<label>Sales Rep</label>
<input type="text" class="form-control" ng-model="search.salesrep">
</div>
And this is my ng-repeat:
<tbody ng-repeat="target in arrayTargets | filter:search">
<td class="salesRepTable"> {{target.salesrep}}</td>
</tbody>
I hope you guys can help me, I do not know what I'm doing wrong.
Upvotes: 1
Views: 410
Reputation: 14590
It should be:
<tbody>
<td class="salesRepTable" ng-repeat="target in arrayTargets | filter:search.salesrep">{{target.salesrep}}</td>
</tbody>
Upvotes: 3
Reputation: 8971
filter on search.salesrep
:
target in arrayTargets | filter:search.salesrep
Upvotes: 0
Reputation: 5792
Your input box binds to search.salesrep
, but your filter binds to search
(which is a complex object). Try this: filter:search.salesrep
Also, you are putting the ng-repeat
on tbody
, which means you will have multiple tbody
elements. You probably intend to generate multiple td
elements, so put the ng-repeat
on the td
element
Upvotes: 2