This is search filter directives
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'filter'
})
export class FilterPipe implements PipeTransform {
transform(items: any[], searchText: string): any[] {
if (!items) return [];
if (!searchText) return items;
return items.filter(item => {
return Object.keys(item).some(key => {
return String(item[key]).toLowerCase().includes(searchText.toLowerCase());
});
});
}
}
Below is the HTML code with array table
<input type="search" class="col-sm-3.1 m_left16 " id="searchAll" [(ngModel)]="searchAllDataBenchmark"
placeholder="Search by keywords" autocomplete="off">
<tr *ngFor="let i of userArray2 | filter: searchAllDataBenchmark | paginate: { itemsPerPage: count, currentPage: p } ">
<pagination-controls (pageChange)="p = $event"></pagination-controls>
It's working properly when stay in 1st page in the pagination search filter is working. But when click the send page and search any table data it's not working and data table is not filtering. Data table array is showing blank.
Can any one resolve this issue which I am facing.
"ngx-pagination": "^5.1.1"