Better History Navigation

My app uses a combination of tabs and a left menu for navigation which made things interesting when I tried using it on an iPhone without a hardware back button. Since the default back button implementation tracks history in tabs separate from everything else, I put together a navigation history that tracks history globally. It depends on everything being within a state (ui-router) instead of urls, but works great for my purposes. I didn’t want to try and dig out the second history stack that is there, I use that for debugging so i can see the navigation pattern of the users since going back removes the history item from the main array.

Codepen Demo