[英]Ionic 2 Side Menu Not Popping Up
I am completely new to Ionic as of last night and I've created a blank project and now stupidly realized that I'd like to have a side menu in there. 截至昨晚,我对Ionic还是陌生的,我创建了一个空白项目,但现在却愚蠢地意识到,我想在其中添加一个侧面菜单。 So I've followed a couple of online tutorials to add one in, but no matter what I try I can get the menu to show when I click the menu toggle icon button.
因此,我已经按照几个在线教程进行了添加,但是无论我尝试什么,只要单击菜单切换图标按钮,我都可以显示菜单。
Here's what I've added in to try and make this work: 这是我添加来尝试使之工作的内容:
app.html app.html
<ion-menu side="right" [content]="content">
<ion-content>
<ion-list>
<button>Page 1</button>
<button>Page 2</button>
</ion-list>
</ion-content>
</ion-menu>
<ion-nav #content [root]="rootPage" swipeBackEnabled="false"></ion-nav>
app.component.ts: app.component.ts:
import { Component, ViewChild } from '@angular/core';
import { Platform, Nav } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { HomePage } from '../pages/home/home';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any = HomePage;
@ViewChild(Nav) nav: Nav;
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
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();
splashScreen.hide();
});
}
}
home-logged-in.html: home-logged-in.html:
<ion-header>
<ion-navbar color='primary'>
<button ion-button menu-toggle>
<ion-icon name="menu"></ion-icon>
</button>
</ion-navbar>
</ion-header>
<ion-content padding>
</ion-content>
Wrong attribute. 属性错误。 Replace:
更换:
<button ion-button menu-toggle>
With: 带有:
<button ion-button menuToggle>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.