2016-06-16 22 views
5

Tôi đang cố gắng thêm 'burger' menu vào mẫu ionic2 trống. Không chắc chắn những gì đang làm sai ở đây nhưng tất cả tôi đã làm là tạo ra một mẫu ion trống, thay đổi mẫu chuỗi để templateUrl trong app.ts và dán mã vào app.html. Không nhận được bất kỳ lỗi giao diện điều khiển nào.Thành phần menu không hiển thị

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> 

Trả lời

3

Tôi đã mất tích vào nút

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

Từ home.html

<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> 
Các vấn đề liên quan