I know about this question here: AngularJS : Initialize service with asynchronous data which I have used in the past on 1.1 and 1.2.
But this requires you need to use old ngRoute module. I'm using ngNewRouter (available for angular 1.x) and don't have a resolve method for the routeProvider.
However it is possible to be done in components, not with the main controller:
//before navigation finishes, useful to load required data
appController.prototype.activate = function() {
console.log ('loading data for the user');
console.log (this.authService.requestCurrentUser());
return this.authService.requestCurrentUser();
}
Still, the main controller it's not a component, so $componentLoaderProvider is not available.
How do I make the app wait for async data, without adding return this.authService.requestCurrentUser() to every component?
Thank you!