I'm building my first angular app and many of the major features are separated into their own modules. Each module registers its routes in config with $stateProvider.
I want to be able to handle $stateChangeStart/$stateChangeError in one place for my whole app so I can evaluate authorization and handle errors. How do I do this?
Currently I have this handler registered on $rootScope on my main module/app but if I navigate to a route from another module and then navigate to another route it does not fire. Why? In fact even $urlRouterProvider.otherwise("xyz"); no longer works.
I don't like copy pasting code so any solution that avoids putting this logic in every module would be appreciated.