Quick Tip: Navigating in Ionic without History

This post is more than 2 years old.

Before I start, just a quick note. What I'm describing here is clearly documented, but as I keep reminding myself I've yet to read 100% of the Ionic docs and I really need to. A big thank you goes out to @breakingthings on the Ionic Worldwide Slack channel for letting me know about this. So here's the question. Imagine you have an Ionic app with a login screen:

iOS Simulator Screen Shot Jul 14, 2015, 12.58.55 PM

After logging in, you want to automatically move the user to a new state:


But when you do, you end up with this in your header:


That link back to the Login view comes from how Ionic handles view history and the header. Most of the time you probably want that, but in this case, I definitely do not want it. Luckily it is rather simple to fix using $ionicHistory:

    disableBack: true

Yep, that's it. Nice and simple. And just in case it isn't clear, this modification only impacts the next change.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Archived Comments

Comment 1 by LeftyX posted on 7/15/2015 at 2:34 PM

This is a great tip. Thanks.

Comment 2 by PissedODev posted on 5/7/2017 at 2:41 AM

Long Live Raymond!
You saved the day

Comment 3 (In reply to #2) by Raymond Camden posted on 5/8/2017 at 1:47 PM

Glad it was helpful!