Side Menu + Tabs + History on android device


#1

So there have been many posts about using the side menu alongside the tabs in ionic. I have an example that is purely for working on making sure the android hardware button backs out of the navigation history as expected, and it does not at this time test views that are navigated to once inside a particular tab.

The intention for the app I’m working on is to have an initial login screen, then a next view that has a side menu. Inside the side menu there is another view the user can navigate to that would have a tabbed interface (i.e. think messaging view inside a larger app).

See the Pen Ionic SideMenu + Tabs by Jameson Taylor (@jwt02180) on CodePen.

So I’ll try my best to explain my issue, since I think it’s a bit confusing. I’m developing a native hybrid mobile app, and deploying to device using Telerik AppBuilder and cordova. I’ve tracked the odd behavior down to it only being present when cordova is around.

  • In the pen, the back button in the browser works as expected (body class is ‘platform-browser’)
  • On device, without cordova.js in index.html, the android hardware back button works as expected (body class is ‘platform browser’)
  • On device, as soon as cordova.js is included the history issue appears (body class is ‘platform-webview platform-cordova’)

This particular history issue is basically an infinite loop between the tabs after visiting each one in a particular order. Here is my navigation stack to reproduce my issue:

  1. enter app
  2. open drawer -> messaging
  3. sent -> contacts -> settings -> inbox -> sent -> contacts -> settings -> inbox -> sent -> inbox -> sent -> inbox -> contacts

At this point using the android hardware back button will just cycle between settings, contacts, and inbox. Oddly enough sent is never part of this loop.

So long story short, I know this is weird, probably outside the supported use case for ionic, and the fact that including cordova.js causes the issue would suggest possibly it’s an issue with them, makes me skeptical for any help. But I’ve had a lot of success getting help here and I hope you guys can at least give it a test for me and offer an ideas?