Load on demand angularjs modules. Angularjs module is designed to download other modules angularjs when they need them (lazy load).
- Dependencies are automatically loaded
- Debugger like ( no eval code )
- The ability to mix normal boot and load on demand
Put loadOnDemand.js into you project:
<scriptsrc="loadOnDemand.js"></script>
Specify dependence loadOnDemand module for your application:
varapp=angular.module('app',['loadOnDemand']);
Configure the service provider $loadOnDemandProvider
app.config(['$loadOnDemandProvider',function($loadOnDemandProvider){varmodules=[{name: 'module_name',// name of modulescript: 'js/module_name.js'// path to javascript file}];$loadOnDemandProvider.config(modules);}]);
When will need to download the module, enter it in the markup by the directive load-on-demand:
<divload-on-demand="'module_name'"></div>
See the example in the folder 'example'