I’m using Ionic Beta 13. Here’s the structure I need:
Using the state config below, I have all of the black arrows (see attached png) working. Home and Account both have the menu icon that when you click it slides the foreground to reveal the left menu. Home and Account are both accessible in the left menu. Deeper views like Events and Edit Acount show a back button in the nav which replaces the menu icon.
However, when in the Account view and the user clicks a Sign Out link, I need to navigate the user to Home (red arrow). It works but the back button is there AND the menu icon. Furthermore, the history is weird, I can navigate from Home back to Account which I don’t want. Please advise. I’ve tried state.go(‘app.home’) and ^.home and I’ve tried using $location.path, all produce the same result.
$stateProvider.state("app", url: "/app" abstract: true templateUrl: "templates/menu.html" controller: "AppCtrl" ).state("app.home", url: "/home" views: menuContent: templateUrl: "templates/home.html" controller: "HomeCtrl" ).state("app.events", url: "/events" views: menuContent: templateUrl: "templates/events.html" controller: "EventsCtrl" ).state("app.eventDetail", url: "/events/:event_id" views: menuContent: templateUrl: "templates/eventDetail.html" controller: "EventDetailsCtrl" ).state("app.myUserProfile", url: "/my/account" views: menuContent: templateUrl: "templates/userProfile.html" controller: "MyAccountCtrl" ).state("app.editProfile", url: "/my/account/edit" views: menuContent: templateUrl: "templates/editProfile.html" controller: "MyAccountCtrl" ) # if none of the above states are matched, use this as the fallback $urlRouterProvider.otherwise "/app/home"
I’ve created a codepen to demonstrate the weird top nav behaviour when navigating from one sibling to another. This is based off another example I found:
click Attendees in the left nav then click Sign Out. It’ll take you to Checkin (also a root nav view) but there’s a back button and there shouldn’t be.