I want to create a side menu in ionic 2 application where the page navigation component is placed in a external json file fetched with the help of menuService.getMenu function.
MY JSON structure:
"menu":[
{
"title":"Grid",
"component":"GridPage"
}
]
My Ts:
this.menuService.getMenu().then((menu) => {
this.menu = menu;
});
openPage(menu) {
console.log("menu", menu.component);
nav.setRoot(menu.component);
}
Console log prints the string GridPage. I tried to convert using Type as Type(menu.component). But my result in console is a function with anonymous name. Someone please help me on getting the json string converted to component "Type" for navigation to work.