Closed abelrgr closed 8 years ago
Easy, just use the dependency injection to include one resolve into the other (and don't forget to return $timeout since it's a promise):
state('products', {
url: "/products",
views: {
"main": {
templateUrl: 'products/list.html',
controller: 'productsCtrl',
}
},
resolve: {
loadProducts: ['$timeout', '$rootScope', function($timeout, $rootScope) {
// dummy delay for testing
return $timeout(function() {
$rootScope.products = [1, 2, 3];
return true;
}, 3000);
}],
loadMyCtrl: ['$ocLazyLoad', 'loadProducts', function($ocLazyLoad, loadProducts) {
return $ocLazyLoad.load('products/list.js');
}]
}
});
Works great, thanks :)
Hi, I'm looking trough the documentation and cannot find a way to build chained resolves:
I want to wait for the "loadProducts" first to enter to the "loadMyCtrl" resolve