Quick start
I want to start like right now!
-
Download ocLazyLoad.js. It can be found in the 'dist' folder of the git repository. You can also install it with
bower install oclazyload
ornpm install oclazyload
. -
Add the module
oc.lazyLoad
to your application:
var myApp = angular.module("MyApp", ["oc.lazyLoad"]);
- Load on demand:
myApp.controller("MyCtrl", function($ocLazyLoad) {
$ocLazyLoad.load('testModule.js');
});
With $ocLazyLoad you can load angular modules, but if you want to load any component (controllers / services / filters / ...) without defining a new module it's entirely possible (just make sure that you define this component within an existing module).
There are multiple ways to use $ocLazyLoad
to load your files, just choose the one that you prefer.
Also don't forget that if you want to get started and the docs are not enough, see the examples in the 'examples' folder!
Updated 26 days ago