Here is the code snippet:
$routeProvider .when("/page1", { controller: "MyController", resolve: {Strategy: "StrategyOne"}})
The code above waits for the resolution of the Strategy dependency before instantiating the "MyController" controller.
In my application, there is a function that returns a promise. This promise, when resolved, provides information about the current user. Let's refer to this function as Authentication.currentUser()
I want all pages in my app to wait for this promise to be resolved before rendering any page. Instead of adding a line for each route declaration, I am looking for a solution that avoids duplication.
A controller named 'MainCtrl' is included in all pages through this line in the template:
<html ng-app="clientApp" ng-controller="MainCtrl">
One idea to address this could be specifying Authentication.currentUser()
as a dependency of "MainCtrl" at the controller level (not at the route level, since this dependency is not specific to a particular route).
Your assistance on this matter would be greatly appreciated!