I am preparing an array like the below when my page load (ngOnInit() method). But when the page loads I am getting an error in console as
ERROR Error: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.
which is not happening with Angular earlier versions.
I am using primeng to display the data on html
How can I prepare the arrays which will not get the console error.
Thanks in advance.
<p-megaMenu [model]="infoItems" (click)="click($event)"></p-megaMenu>
import { MenuItem } from 'primeng/api'
infoItems: MenuItem[];
this.infoItems = [
{
label: 'Configuration Data',
icon: 'fa fa-fw icon-configuration',
items: [
{ label: 'Preview Configuration'}, { label: 'Configuration label' }
]
}
];