ng2-search-filter
ng2-search-filter copied to clipboard
Issue with filter
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 ?
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">