When loading the /home state, I need to retrieve all users from the database in order to customize the home controller and view based on the logged-in user. Currently, in the :resolve section of the state configuration, I am fetching all 'posts' from the database. However, I am facing difficulty implementing multiple promises at once.
Below is my code for the /home state:
$stateProvider
.state('home', {
url: '/home',
templateUrl: '/home.html',
controller: 'MainCtrl',
resolve: {
postPromise: ['posts', function(posts){
return posts.getAll();
// I want to include another promise here as well.
}]
}
})
Essentially, I would like to execute a users.getAll() function within the resolve of the /home state but I am struggling with the syntax to accomplish this task.