I am working on a SPA which defines many routes using angulars $routeProvider.
Before any routing occurs, I want to execute some asynchronous actions, especially fetching a list of localized strings used in the whole application. I therefore want to delay the routing until all those actions (which are actually promises) were resolved. If any is rejected, the application should stop and show a generic error message.
I could return some ensureInitialized() promise from the resolve parameter of the route definition, but this would require me to do it for all possible routes and lead to code duplication.
Is there any better way to achieve this? What would you propose?