I have a sidemenu fron JSON data,
but i need some menu as static.
private initializeOptions(): void {
for(let i =0; i < this.sidemenus.length; ++i) {
this.myArray.push({'displayName': this.sidemenus[i].category,"subItems":[]});
for (let j=0; j < this.sidemenus[i].subs.length; ++j) {
this.myArray[i].subItems.push({'displayName': this.sidemenus[i].subs[j].subcategory,'component': 'MainshopPage'});
}
}
console.log('myArray',this.myArray);
alert(JSON.stringify(this.myArray))
this.options = this.myArray;
// this.options = new Array<MenuOptionModel>();
}
i tried this
private initializeOptions(): void {
this.myArray.push({
displayName: 'Home',
component: HomePage,
});
for(let i =0; i < this.sidemenus.length; ++i) {
this.myArray.push({'displayName': this.sidemenus[i].category,"subItems":[]});
for (let j=0; j < this.sidemenus[i].subs.length; ++j) {
this.myArray[i].subItems.push({'displayName': this.sidemenus[i].subs[j].subcategory,'component': 'MainshopPage'});
}
}
console.log('myArray',this.myArray);
alert(JSON.stringify(this.myArray))
this.options = this.myArray;
// this.options = new Array<MenuOptionModel>();
}
but it shows error