resolve of angularJS
1 a resove. $routeProvider . when ( '/users' , { templateUrl: '...' , controller: 'UserListController' , resolve: { users: function(User) { return User.getAll(); } } }); app.controller( 'UserListController' , function (users) { $scope .users = users; }); 2. $q.all $routeProvider . when ( '/users' , { templateUrl: '...' , controller: 'UserListController' , resolve: { data: function(User, Post, $q ) { deferred = $q .defer(); $q .all([User.getAll, Post.getTops()]).then(function(results) { deferred.resolve({ users: results[ 0 ], posts: results[ 1 ] }) }); return deferred.promise; } } }); ref: boiajs . c om/ 2015/ 08/ 27/ angular-route-use-resolve