I'm new to Angular.
I have a demo array like this:
for (let index = 1; index <= 100; index++) {
this.listOfData.push([
`Name ${index}`,
`Math.floor(Math.random() * 100)`,
'Employee',
]);
}
And I try to create a filter table with search function:
onSearch = (value) => {
const output = this.listOfData.filter((arr) =>
arr.some((item) => {
item.toLowerCase().includes(value);
})
);
console.log('output: ', output);
this.listOfDisplayData = output;
};
This is my demo
So basically your data item is
[[string,string,string],...]
when you start filtering withfilter
you must returntrue
for it to include andfalse
to filter it out.This should fix it