No back button in your Ionic header?

A few months ago I wrote up a quick article about titles not correctly updating in Ionic V1 apps (Is your Ionic View title not updating?). Today I’ve run into another little issue with the header. I was working on a very quick demo for a presentation tonight and had an app with a grand total of two views - a master list and detail. Everything was working fine, but then I noticed I didn’t have a back button when looking at the detail view. As far as I could tell, my code was fine. Here’s what I had in the index.html file:



And each view was pretty simple as well. You can see the problem in action at this CodePen: (I apologize for the formatting in the code - I was cutting and pasting rather quickly.)

I brought it up in the Slack chat and Mike Hartington came to the rescue rather quickly. Turns out the fix was… applying a class. Seriously. Even though the header has a class by default, if you don’t explicitly specify one, then the back button won’t show up. Literally - the fix is just this:

<ion-nav-bar class="bar-royal">


You can see this working in a CodePen Mike made for me:

Obviously I think this is - well - bunk (grin) - so I’ll filed a bug report for it here: Back button will not show up if you do not specify a class for the nav bar.

And in case you’re curious - here is the “Before” picture of this mission-critical Enterprise demo:

And here is the “After” picture:

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA