Hide back button for Android only Ionic 2


#1

To Hide back button:
<ion-navbar hideBackButton *navbar>

hideBackButton in the navbar helps to hide the back button. I want to conditionally hide the button on Android and show on IOS. As android can use its native back buttons.

is there a way to conditionally show back button on ios and hide on android.

I have tried with having two navbar tags in the code with “showWhen=ios” “showWhen=android” on of them alternatively, Ionic does not pick up the second occurance of navbar at all.

I believe Ionic should not show back button by default on Android.

Any Help!!


#2

Ok, this post is pretty old, but as it shows first when searching for this question, so here comes a solution.

Just set .back-button-md {display:none !important;} in your app.scss and the button is gone on android, if you are using the material design layout that is default for android in Ionic 2.

Maybe there are other ways, but this one works just fine.


#3

worked for me, thanks. i was thinking of doing it from code using platform and viewcontroller