Remove back button

How can i remove the back button from my pages?
I tried that config: { backButtonText: '' } but it only hides, if the user still clicks in the place where the back button is, it is activated.
Or is there a way i can change the ionic default back button to an icon?

Thanks

You tried this?

<ion-navbar hideBackButton *navbar>< /ion-navbar>

Or please refer to:

21 Likes

@zhouhaowowtv thanks man, it worked.

This removes back button but it also removes menu button. Is there any way to show menu button, but remove back button with following code?

this.navCtrl.push(page)

Thanks

1 Like

To me, the back button is part of the entire point of using push. Can you achieve what you want using setRoot instead?

6 Likes

you are indeed correct, setRoot is the way it should be done

It’s work for me but it’ll also hide the menu bar also can u please tell me any solution

What about cases with Tabs? If I set the root page to the “Home Page”, my tabs aren’t shown after login. If I set the root to “Tabs page” then the back button shows. Any suggestions how to reset the root page in this case?

@VivekDesigner try this code

 > <ion-header>
    >   <ion-navbar hideBackButton >
    >     <ion-title>Session</ion-title>
    >   </ion-navbar>
    > </ion-header>
12 Likes

Thanks it’s working fine

@VivekDesigner how on earth did you manage?! I’ve tried a lot of stuff, and the back button is still there…

are you using “push” for navigation?

Right now I’m using setRoot.

It’ll work fine man.
If you are using push only that back button will come.
Is it possible means you can show ur html and ts code, Then it’ll help me to find the problem

1 Like

Thanks finally found a solution. Such a simple bit of code, so much time wasted trying to do a workaround lol! THUMBS UP!!

1 Like

Works fine with ionic 2.

/* CSS /
[show]{
display: block !important;
}
/
ion- nav /
/

<ion-navbar class="white_bg" hideBackButton>
    <ion-butto*/ns start left>
        <button ion-button show menuToggle>
            <i class="menu_icon"><span></span></i>
        </button>
    </ion-buttons>
    <ion-title>title</ion-title>
</ion-navbar>

*/

try this it’s work for me
[/quote]

try this it’s work for me

2 Likes

To do not remove the menu icon use this css code in your app.scss

ion-navbar[hidebackbutton] button[menutoggle] {
  display: block !important;
}
2 Likes

hideBackButton="true"

use this inside your ion-navbar

Use setRoot instead of push if you want to remove back button and keep menu bar. For example:

 public gotoAbout() {
     this.navCtrl.setRoot(AboutPage);
   }

I did this and it worked. :slight_smile:

5 Likes