Hamza L.
Hamza L.

Reputation: 1823

hideBackButton attribute hides the menuToggle button too

The Problem

I push the Root Page to Page2 that supports a side menu, the issue is that when it opens Page2 it shows the back button and hides the menu button for that I've tried to add hideBackButton to Page2 in order to see the menu button but I both the back button and menu button disappeared!

Here is my current code:

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

The expected behavior should be:

Should hide the back button, and show the menu button.

Ionic Version:

Ionic2

Upvotes: 2

Views: 1310

Answers (3)

Abhishek Pandya
Abhishek Pandya

Reputation: 129

You can use following instead of your code:

<ion-toolbar hideBackButton>
       <button menuToggle start>
       <ion-icon name="menu"></ion-icon>
       </button>
 </ion-toolbar>

Upvotes: 2

David Dal Busco
David Dal Busco

Reputation: 8652

If you don't want to allow the "back" action on your Page2, and since you face a problem hiding the button, why not removing your root page from the history stack before accessing your Page2?

In such a case, the "back" action not gonna be allowed and the "back" button not gonna be displayed too.

About how to remove a page from the history stack before pushing another page, you could have a look at:

Remove a view from the back history - Ionic2

Upvotes: 0

Folky.H
Folky.H

Reputation: 1204

You can't do that following that way; however what you can do is to do a setRoot instead of pushing from the root to Page2

Upvotes: 2

Related Questions