'PrimeNg dinamyc MegaMenu doesn't appear
I'm creating a MegaMenu dynamically, starting from a map:
this.menuItems = new Array<MegaMenuItem>();
this.map.forEach((value: Map<string, any[]>, key: string) => {
const catArray: Array<Array<any>> = new Array<Array<any>>();
value.forEach((inValue: any[], inKey: string) => {
const catMenu = {
label: inKey,
items: inValue
};
catArray.push([catMenu]);
});
const moduleMenuItem: any = new Object();
moduleMenuItem.label = key;
moduleMenuItem.items = catArray;
this.menuItems.push(moduleMenuItem);
});
In HTML:
<p-megaMenu [model]="menuItems"></p-megaMenu>
The MegaMenu is correctly configured. If I test it with the example of the PrimeNg site it works fine. It seems like the object menuItems is not properly created but I can't understand where I'm wrong.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
