I have the initial array of data dataToDisplay and the array that I need to add filtered arrays into it dataToDisplay. I used .filter() to do so:
this.dataToDisplay = this.dataToDisplay.filter((res)=>{
console.log(res);
if(res.type==this.filterArray['typeOfIns'])
{
this.dataToFilter = res;
console.log(this.dataToFilter)
//this.dataToFilter = res;
//console.log(this.dataToFilter)
}
})
I got an error saying:
ERROR Error: Error trying to diff '[object Object]'. Only arrays and iterables are allowed
The result at line 58: console.log(this.dataToFilter) is returning the right arrays but cannot be displayed and binded into the page.
dataToDisplay is having the following structure:
dataToDisplay = [
{id:.., type:.., name:..},
{id:.., type:.., name:..}
]