ng2-search-filter icon indicating copy to clipboard operation
ng2-search-filter copied to clipboard

Issue with filter

Open nicolasstrands opened this issue 7 years ago • 1 comments

Hello guys,

I have installed the ng2-search-filter in a project I'm working on. My objective was to filter out entries rendered by an ngFor, that gets its data from an SQL query inside a PHP file, where the output is rendered as json data. My data is displayed correctly, but when I add the search filter, and use it as such :

<input type="text" [(ngModel)]="term" 
            class="form-control form-control-sm" placeholder="Search">
<tr *ngFor="let customer of customers | filter: term">
          <td>{{customer.cust_id}}</td>
          <td>{{customer.company_name}}</td>
          <td>{{customer?.contact_person}}</td>
</tr>

My guess is that it's not filtering any data because it doesn't know which column in my data table to filter. Any clue in how to fix this ?

nicolasstrands avatar Oct 25 '17 06:10 nicolasstrands

Hello StrandsMedia, the one in bold and italic resolve your problem:

<input type="text" name="term" [(ngModel)]="term" class="form-control form-control-sm" placeholder="Search">

eliuddyn avatar Apr 05 '18 21:04 eliuddyn