Prevent Back Button from showing up on Ionic 2


#1

Hi, I’m using some boilerplate navbar.
I’m wondering how can i tell it not to show the Back Button if i navigate to this page?

Also, if someone can point me to the documentation, that would be great… i can’t seem to find it in the docs

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

    <ion-segment [(ngModel)]="segment" (change)="update()">
        <ion-segment-button value="asd">Asd</ion-segment-button>
        <ion-segment-button value="qwe">Qwe</ion-segment-button>
    </ion-segment>
</ion-navbar>

#2

Its not documented, but you can do this:

<ion-navbar *navbar hideBackButton="true">


#3

this works, but then the menuToggle icon doesn’t show up


#4

maybe try manually making a menu button?

  <button (click)="toggleMenu()">
     <ion-icon name="menu"></ion-icon>
   </button>

Maybe the toggleMenu() code could inclue something like this:

this.menu.open('left');

This is a hacky solution, but worth a shot.


#5

Had the same problem, I’ve fixed it by using nav.setRoot(PageComponent) instead of nav.push(PageComponent).


#6

Thanks nunoarruda you save my day! :slight_smile: