Discussions

Ask a Question
Back to All

OCLazy load don't resolve all dependencies first before loading the controller.

I am loading module lazily with ocLazyLoad.

It is something like :

angular.module('lazyModule', [ 'lazyModule.services', {
files : [
'path to services.js'
],
cache : true
}]);

Inside service.js, I have other dependencies :

angular.module('lazyModule.services', [
{
files : [
'path to some constants.js',
'path to some services.js',
'path to some model.js',
'path to some provider.js'
],
cache : true
}
]);

In the route file I loaded the module as :

.state('app', {
templateUrl : 'some url',
resolve : {
loadModule : ['$ocLazyLoad', function ($ocLazyLoad) {
return $ocLazyLoad.load(['airtel.postpaid']);
}]
}
})

Module is loaded properly, but my view is loaded before the service.js dependencies(constants, models, providers etc.). I want to load all the module dependencies first and then the controller.