Clearing history between tabs

I have four tabs which have subviews which make use of the navbar back button. I want to clear the history stack whenever a user switches tabs. I tried adding nav-clear on my ion-tab elements but it seemed to have no effect.

I don’t want to preserve the history stack when users navigate between tabs. Going to a tab should display the primary tab view. I saw one place where someone used $state.go when the tab was selected, but that seems like the wrong approach. Suggestions?

@aaronksaunders has a good post about this.

http://www.clearlyinnovative.com/blog/post/34758525881/ionic-framework-tabs-go-home-view

Here’s his codepen.

That approach works, it just doesn’t seem like the best way to do it. It causes another transition as well as creating another slight visual flash for the user. I was hoping for something where you could more directly empty the history stack or some such when you transition from tab to tab.

What if all you want to do is to skip the animation? You don’t want the nested views, you just want animation to be skipped. It seems strange that nav-clear does not work on tabs…

Have you tried setting animation=“no-animation”?

http://ionicframework.com/docs/api/directive/ionNavView/

Excuse me for not being completely transparent here. I want only tabs-switching to skip animated transitions. For other URLs I want usual, animation-based behavior.

It should still work to assign no-animation to your tabs

How should I set this attribute for tabs, if I only have one ion-nav-view for the whole app?

If you are talking about <ion-tabs>'s no-animation class, it does not work as the navigator seems to have precedence, since we are using hrefs.