Ionic | App from Scratch – Two Sidemenus

Prepare your starter App

ionic start App sidemenu --type angular --no-git

Change into the newly create folder and start the Ionic App

cd App
ionic serve

You will see the default Ionic Sidemenu App

The entries of the sSidemenu are defined in app.components.ts:

export class AppComponent {
	public appPages = [
		{ title: 'Home', url: '/home', icon: 'home' },
		{ title: 'List', url: '/list', icon: 'list' }

The sidemenu itself and his apperance are defined in app.component.html:

  <ion-split-pane contentId="main-content">
    <ion-menu contentId="main-content" type="overlay">
          <ion-menu-toggle auto-hide="false" *ngFor="let p of appPages">
            <ion-item [routerDirection]="'root'" [routerLink]="[p.url]">
              <ion-icon slot="start" [name]="p.icon"></ion-icon>
    <ion-router-outlet id="main-content"></ion-router-outlet>

The Sidemenu entries and the Icon are added in line 13 and 14 to the sidemenu.

Define two sidemenus in app.html

<ion-menu [content]="contentLeft"> ....</ion-menu>
<ion-menu side="right" [content]="contentRight">....</ion-menu>

<ion-nav [root]="rootPage" #contentLeft #contentRight swipeBackEnabled="false"></ion-nav>

Add buttons to page

      <button ion-button start menuToggle>
         <ion-icon name="menu"></ion-icon>
      <ion-title>Demo of two Sidemenus</ion-title>
      <button ion-button end menuToggle="right">
<ion-content padding>
Github Repository

You can find the code here

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.

de German