I am trying to transform an array with strings inside in lowercase using toLowerCase, but it seems that it does not work with an array and only with a string ... How do I solve this?
items: Array<{tag: string[], image: string, page}>;
toggledItems() {
this.items = [
{
tag: ['exemplo1','exemplo2'],
image: '../../assets/imgs/exemplo/ccc.jpg',
page: Ex1Page,
},
{
tag: ['exemplo4', 'exemplo5', 'exemplo6'],
image: '../../assets/imgs/exemplo/ci.jpg',
page: Ex1Page,
}
];
}
In the code below is where I add the array "tag" that is inside the "items" array. But it does not work.
if (val && val.trim() != '') {
this.items = this.items.filter((item) => {
return (item.tag.toLowerCase().indexOf(val.toLowerCase()) > -1);
})
}