loadOnDemand

angularjs load on demand module

Added by: Sam Deering

GitHub

Repository

andygrom/loadondemand

Stats

Stars: 82

Watchers: 82

Forks: 20

Module Description

loadOnDemand

Load on demand angularjs modules. Angularjs module is designed to download other modules angularjs when they need them (lazy load).

Key features

  1. Dependencies are automatically loaded
  2. Debugger like ( no eval code )
  3. The ability to mix normal boot and load on demand

Using

  1. Put loadOnDemand.js into you project:

    <script src="loadOnDemand.js"></script>
    
  2. Specify dependence loadOnDemand module for your application:

    var app = angular.module('app', ['loadOnDemand']);
    
  3. Configure the service provider $loadOnDemandProvider

    app.config(['$loadOnDemandProvider', function ($loadOnDemandProvider) {
        var modules = [
            {
                name: 'module_name',     // name of module
                script: 'js/module_name.js' // path to javascript file
            }
        ];
        $loadOnDemandProvider.config(modules);
    }]);
    
  4. When will need to download the module, enter it in the markup by the directive load-on-demand:

    <div load-on-demand="'module_name'"></div>
    

See the example in the folder 'example'

Module stats last updated: 2017-09-14 16:00:05

Disclaimer: Some data on this page may have been gathered from the authors GitHub respository. If you see any mistakes or outdated information please let us know. Thanks!