I am using UI-router with sticky states. For the hash tag functionality below, I use $location.hash() as the getter/setter.
I have a tabbed AngularJS app where there are sticky states (so when I switch between tabs, the controllers don't reload). So if I click on one of the tabs, my URL becomes '/tab1/#subtab1'. I can switch to another part of the app and the URL will become say, '/tab2', and when I switch back to tab1, the URL stays '/tab1/#subtab1' where I left off. This is all fine.
However, when I click on my active main tab more than once (though I doubt 99% of eventual users will do this), the 'subtab1' part gets removed, and the URL just becomes '/tab1#'.
The $rootScope.$on('$stateChangeStart') event doesn't detect this event. I have tried putting a ng-disable or trying to intercept this event somehow, but seems I am looking in the wrong places.