I'm trying to defer loading of my main controller/template (AppController) until I load the users profile from a service.
For all navigation routes, I'm using $routeProvider with resolve
.when('/edit/:editId', {
templateUrl: 'editTemplate.html',
controller: 'EditController' // this is a child controller of AppController
resolve: {
currentUser: ['svc.user', function(userSvc) { return userService.getUser(); }]
}
// and so on..
But for AppController I'm using
How can I do a resolve for AppController? Essentially, I'd like a userService.getUser() which returns a promise to finish executing before AppController is actually run, I'm not sure how to do this using ng-init though (or if it's possible, i thought only expressions not promises could be executed).
Thanks for any help/assistance.