I am implementing the simple primeng megamenu. I am getting the following error. Can anyone please help whats wrong with my code and how to fix if there is an issue? I followed the sample code mentioned in primeng. The following code only displays the top menu item and not the submenu items.
Primeng version i am using is : ~4.1.0
Component:
import { MegaMenuModule } from 'primeng/primeng';
<p-megaMenu [model]="items"></p-megaMenu>
items: Array<MenuItem>;
this.items = [
{
label: 'TV', icon: 'fa fa-fw fa-check',
items: [
{
label: 'TV 1',
items: [{ label: 'TV 1.1' }, { label: 'TV 1.2' }]
},
{
label: 'TV 2',
items: [{ label: 'TV 2.1' }, { label: 'TV 2.2' }]
}
]
},
{
label: 'Sports', icon: 'fa fa-fw fa-soccer-ball-o',
items: [
{
label: 'Sports 1',
items: [{ label: 'Sports 1.1' }, { label: 'Sports 1.2' }]
},
{
label: 'Sports 2',
items: [{ label: 'Sports 2.1' }, { label: 'Sports 2.2' }]
}
]
},
{
label: 'Entertainment', icon: 'fa fa-fw fa-child',
items: [
{
label: 'Entertainment 1',
items: [{ label: 'Entertainment 1.1' }, { label: 'Entertainment 1.2' }]
},
{
label: 'Entertainment 2',
items: [{ label: 'Entertainment 2.1' }, { label: 'Entertainment 2.2' }]
}
]
}
];
Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.
Thanks