How to prevent back button on top


#1

Hi, please, how can I prevent that back button on top?
When change (push) from page 1 to page 2, the back button could not appear on page 2.

Thanks.


#2

Hi,
In your page 2 add

hideBackButton="true"

in ion-navbar tag

<ion-navbar hideBackButton="true">
    <ion-title>Title</ion-title>
</ion-navbar>

#3

Great, but if I press back button on device, I am going to page 1. How to remove page 1 from “history”?


#4

So why you don’t use setRoot

this.navCtrol.setRoot('page2');

Instead

this.navCtrl.push(page2)

#5

This worked!! Thanks…
But… My menu icon (menuToggle) in page 2 is gone when ‘setRoot’.
:joy:

This is my header in page 2:

<ion-header>
  <ion-navbar>
    <button ion-button icon-only menuToggle>
      <ion-icon name="menu"></ion-icon>
    </button>
    <img width="23" height="23" src="assets/imgs/icon.png" style="float: left;">
    <ion-title>
      Title
    </ion-title>
  </ion-navbar>
</ion-header>

#6

Sorry!!! It’s OK now.
I need to ‘setRoot’ of my ‘MenuPage’, and not the Page2. Page 2 is in menu.

Thanks again!