I'm working with AngularJS and ocLazyLoad plugin. And I can't find a solution for my problem.
I have created one component (named as component.js
) and controller for this component (in separate file componentCtrl.js
) and then I have constants, which I use in controller(it's too in separated file constants.js
). And I need to load these files. When I use something like this:
loadPlugin: function ($ocLazyLoad) {
return $ocLazyLoad.load(
{
files: ['../componentCtrl.js','../constants.js',../,'component.js']
},...
My dependencies is loaded fine. But I need this component in more views. Then I have to write this code again and again. Can I define this array of resources before using in lazy load function?
When I have module, It's simple
$ocLazyLoadProvider.config({
modules: [{
name: 'TestModule',
files: ['source1', 'source2',..., 'sourceN']
}]
});
But I don't have special module for this component.It's possible with this plugin ?