Hello,
Just trying to re-gig an app to have some nested views under 1.0.1 but seem to be struggling to get it to work correctly when called from the side menu.
The menu-close directive on the links is clearing the history stack, which prevents a back button from showing. It does a few other things such as close the sidemenu, and disable animation. If you removed this directive you could create your own function to call:
The Ionic framework uses the Angular UI router for handling routes and defining states. So, you should use ‘ui-sref’ in your templates (not ‘href’) and ‘$state.go()’ in your controllers.
Yes that looks like one of the issues and works nicely.
However I would like the Home page to always be the parent to Home1 and Home2.
This is not the case when you click on Check-In for example and the open the side menu again and click on Home1. At this point Check-In is thought to be the parent and not the main Home page.
Yes I had tried the ui-sref but with menu-close set the history gets cleared as brandyshea mentions.
If I remove the menu-close it does set the back button but as mentioned in my reply to brandyshea I would like the Home view to always be the parent of Home1 and Home2 i.e. children to Home.
With the ui-sref set and you click Check-in then Home1 the back button will be set to Check-in rather than home.
I was hoping the ui-router / ionic would have a mechanism to handle the Parent and Child relationship.
If you transition from a state ‘eventmenu.checkin’ to another state ‘eventmenu.home.home1’ then tap the ‘Back’ button, ui-router will take you back to the previous state ( ‘eventmenu.checkin’).
If you want to do something different then add a function to your controller that checks the current state and then takes you where you want to go:
$scope.goHome = function () {
if ($state.is('eventmenu.home.home1')) {
$state.go('eventmenu.home');
}
};
Yes certainly, I’ll give it a test as well. Just need to make sure the Back Button title is correct, which is part of history stack (I think).
I was hoping there might be some ui-router and $ionicHistory magic that allowed specific parenting of views or made use of the state to figure out the return view.
I did have a play with adjusting the history stack which seems to work forcing the correct display of the title and return view i.e. state and url.
Be nice if there was a mechanism to insert a parent view possibly or for histories to take that into account.
-> I was hoping there might be some ui-router and $ionicHistory magic that allowed specific parenting of views or made use of the state to figure out the return view.