1

I am working on the Ionic app and I have used navbar in my ionic app. When I move to other page, In place of menu button it is showing the back button. I don't want to show the back button, I always want to show the menu button in the navbar.

This is page1.html:

<ion-header>
  <ion-navbar hideBackButton="true">
    <button ion-button menuToggle start>
      <ion-icon name="menu"></ion-icon>
    </button>
  </ion-navbar>
</ion-header>

It is only hiding the back button and not showing the menu button. I want to show the menu button in place of back button.

This is page1.html: Another Try.

<ion-header>
  <ion-navbar swipeBackEnabled="false">
    <button ion-button menuToggle start>
      <ion-icon name="menu"></ion-icon>
    </button>
  </ion-navbar>
</ion-header>

This is not working. In this case, It is showing the back button.

This is page1.ts:

 ionViewWillEnter() {
  // Reset the content nav to have just this page
  // we wouldn't want the back button to show in this scenario
  this.navCtrl.setRoot(MerchandisePage);
 }

So I decided the make the page as a root page but It is continuously loading. This is not working.

This is my page.html:

<button (click)="merchandisepage2()" class="mybtn22" ion-button round>View All</button>

In this page, I have the button that will push to the other page.

This is my page.ts:

 movetopage1()
{
    this.navCtrl.push(Page1);
}

I don't want to show the back button, it should always show the menu button in the navbar. Any help is much appreciated.

Rahul Pamnani
  • 1,397
  • 5
  • 26
  • 66

2 Answers2

1

There is an issue with ionic when you have a custom button in the navbar and the page is not root.

You can find a quick fix here..

Ionic 3: Menutoggle keeps getting hidden

itdoesntwork
  • 1,745
  • 16
  • 31
0

The solution is that, set the page to the root page.

page.ts:

movetopage1()
{
    this.navCtrl.setRoot(Page1);
}

This is the method that comes in the Ionic sidebar theme.

This is the one that comes in the Ionic sidebar theme:

 openPage(page) {
    // Reset the content nav to have just this page
    // we wouldn't want the back button to show in this scenario
    this.nav.setRoot(page.component);
  }
Rahul Pamnani
  • 1,397
  • 5
  • 26
  • 66