Skip to content Skip to sidebar Skip to footer

Menu Won't Appear In Ionic2 With Typescript

i'm trying to create a simple menu in the navbar with ionic2. i've followed the tut's but it won't work in my application and i can't seem to understand why. This is the current co

Solution 1:

Maybe you sould add a selector property in the @Page metatada of the Menu class:

import{Page, MenuController} from 'ionic-angular';
@Page({
    templateUrl: 'build/pages/menu/menu.html',
    selector:'app-menu'
})
export class MenuPage {
 constructor(menu: MenuController) {
   this.menu = menu;
 }

 openMenu() {
   this.menu.open();
 }

}

And in your index.html file add:

<app-menu></app-menu>
<ion-nav #content [root]="rootPage"></ion-nav>

EDIT: Add the following into the @Component metadata (for example in Page1 class)

<ion-navbar *navbar hideBackButton>
    <button menuToggle>
      <ion-icon name='menu'></ion-icon>
    </button>
    <ion-title>Tab 1</ion-title>
</ion-navbar>

I've updated your codepen: http://codepen.io/anon/pen/LNGzJN


Post a Comment for "Menu Won't Appear In Ionic2 With Typescript"