2016-06-16 4 views
5

공백 ionic2 템플릿에 'burger' menu'을 추가하는 데 어려움을 겪고 있습니다. 여기에 잘못된 것이 무엇인지 잘 모르겠지만, 빈 이온 성 템플릿을 생성하고 app.ts의 templateUrl에 템플리트 문자열을 변경하고 app.html에 코드를 붙여 넣기 만하면됩니다. 콘솔 오류가 발생하지 않습니다.메뉴 구성 요소가 나타나지 않습니다.

app.ts :

import {Component} from '@angular/core'; 
import {Platform, ionicBootstrap} from 'ionic-angular'; 
import {StatusBar} from 'ionic-native'; 
import {HomePage} from './pages/home/home'; 


@Component({ 
    templateUrl: 'build/app.html' 
}) 
export class MyApp { 
    rootPage: any = HomePage; 

    constructor(platform: Platform) { 
    platform.ready().then(() => { 
     // Okay, so the platform is ready and our plugins are available. 
     // Here you can do any higher level native things you might need. 
     StatusBar.styleDefault(); 
    }); 
    } 
} 

ionicBootstrap(MyApp); 

app.html :

<ion-menu [content]="content"> 
    <ion-toolbar> 
     <ion-title>Pages</ion-title> 
    </ion-toolbar> 
    <ion-content> 
     <ion-list> 
      <button ion-item (click)="openPage(loginPage)"> 
       Login 
      </button> 
      <button ion-item (click)="openPage(signupPage)"> 
       Signup 
      </button> 
     </ion-list> 
    </ion-content> 
</ion-menu> 
<ion-nav [root]="rootPage"></ion-nav> 

답변

3

내가 home.html을에서 버튼

<button right menuToggle> 
    <ion-icon name="menu"></ion-icon> 
    </button> 

누락 된

<ion-navbar *navbar> 
    <ion-title> 
    Blank Starter 
    </ion-title> 
    <button right menuToggle> 
    <ion-icon name="menu"></ion-icon> 
    </button> 
</ion-navbar> 

<ion-content class="home"> 
    <h1 text-center>Content goes here!</h1> 
</ion-content>