Simple filter in ionic / angular
/// first create duplicate temp variable of variable used in the forloop
onSearch(evt: any) {
console.log(evt.target.value);
const val = evt.target.value;
this.usersList = [];
const temp = this.tempUsers.filter(function(d) {
return String(d.ecn).toLowerCase().indexOf(val) !== -1 ||
d.fullname.toLowerCase().indexOf(val) !== -1 ||
d.gender.toLowerCase() === val ||
d.department.toLowerCase().indexOf(val) !== -1 ||
String(d.doj).toLowerCase().indexOf(val) !== -1 || !val;
});
// update the rows
this.usersList = temp;
}
.png)

0 comments: