I wonder if anyone has been able to implement a nested side menu in Ionic 2. As part of my learning process, I am attempting to build a three-level nested menu; something like:
menu-item 1
menu-item 2 -> sub-menu-item 1
menu-item 3 -> sub-menu-item 1 -> sub-sub-menu-item 1
I want to build this into my sidemenu and ensure that pages are pushed onto the stack to implement active item styles (like a book app with chapters).
Since the app.component.ts file controls the sidemenu using Nav and MenuController I attempted to create a function called ‘gotosubMenu’ that would push a sub menu onto the stack like so:
gotosubMenu () {
this.nav.push(SubMenu1);
}
and then in app.html, create a menu item with a button that runs this function:
<button ion-item (click)="gotosubMenu()">
This does not work unfortunately. I have noticed if I repeat the same thing within a page however (SubMenu1 for example), the button will push correctly. I think this means that you cannot push from a Menu component. My next logical conclusion was to use the NavController component in my constructor and have this handle the push function but I now understand that it is not possible to implement a component within a component.
Are there any ways to use the sidemenu in this way, or is the only implementation through removing the Menu component and using Nav as a page by itself?