Nested ui-view in ion-view


Using ui-view inside ion-view appears to work correctly, except for keeping state. Say I have a tabs layout with 2 tabs: Home and About.

And let’s say I want a sub-state in the Home tab. I can get the URL and view to change correctly via:

<ion view view-title="Home">
  <div ui-sref="home.subview1"></div>
  <div ui-sref="home.subview2"></div>

  <ui-view name="subview"></ui-view>

So on clicking any of the divs, I stay in the same <ion-view> (which is what I want) and the subview is changed. The only problem is, say my current URL is app/home/subview2 and I go to a completely different tab, like the About tab, and I come back to the Home tab, the URL (and view) might be something like app/home/subview1. I.e. Ionic isn’t saving the state/history for the subview.

I wouldn’t necessarily expect it to work the way I want, given that it’s ui-view and not ion-nav-view, but is there a way to get it working using this technique, or something more Ionic-like?