Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic 2 keep sidemenu icon after navCtrl push

Tags:

angular

ionic2

When I navigate to a page using navCtrl.push, sidemenu icon (hamburger) is lost, and back icon is appearing instead of the sidemenu icon.

What I want to do, is to keep the sidemenu icon (put it on the right side of the ion-navbar), and when pushing a page to navCtrl, have both back button and sidemenu icon.

I use this piece of code in all pages:

<ion-header>
  <ion-navbar>
    <button ion-button menuToggle right>
      <ion-icon name="menu"></ion-icon>
    </button>
    <ion-title>Post Offices</ion-title>
  </ion-navbar>
</ion-header>

And I use:

this.navCtrl.push(Page)

And it works fine (I lose the menu icon though, but there is no other problem).

like image 535
Mikayel Saghyan Avatar asked Dec 11 '22 14:12

Mikayel Saghyan


1 Answers

You need to add attribute persistent="true" to <ion-menu> then menuToggle button will be available on all views. You can find more details here in the docs

like image 199
Yaroslav Grishajev Avatar answered Dec 13 '22 22:12

Yaroslav Grishajev