{"_id":"552d17e0a86ee20d00780b8f","excerpt":"I want to start like right now!","githubsync":"","version":"552d17dea86ee20d00780b8c","sync_unique":"","user":"5519ab08eaa2ed2f002135a0","body":"1. Download ocLazyLoad.js. It can be found in the 'dist' folder of the git repository. You can also install it with `bower install oclazyload` or `npm install oclazyload`.\n\n2. Add the module `oc.lazyLoad` to your application:\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"var myApp = angular.module(\\\"MyApp\\\", [\\\"oc.lazyLoad\\\"]);\",\n \"language\": \"javascript\",\n \"name\": \"Add the module to your application\"\n }\n ]\n}\n[/block]\n3. Load on demand:\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"myApp.controller(\\\"MyCtrl\\\", function($ocLazyLoad) {\\n\\t$ocLazyLoad.load('testModule.js');\\n});\",\n \"language\": \"javascript\",\n \"name\": \"Basic example to load a module\"\n }\n ]\n}\n[/block]\nWith $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).\n\nThere are multiple ways to use `$ocLazyLoad` to load your files, just choose the one that you prefer.\n\nAlso don't forget that if you want to get started and the docs are not enough, see the examples in the 'examples' folder!","createdAt":"2015-04-14T13:36:32.151Z","link_external":false,"link_url":"","order":0,"project":"552d17dea86ee20d00780b89","title":"Quick start","type":"basic","updates":["5548de0aafc5ed0d00e145f9","5589e3c175eaf50d004e4a8d","56abc6ca4e8ba20d006a23d8","57102fc5c510130e00d0b9d1","579f27015f116a2b004449eb"],"__v":16,"api":{"params":[],"results":{"codes":[]},"url":"","auth":"required"},"category":"552d17dfa86ee20d00780b8d","hidden":false,"isReference":false,"slug":"getting-started","childrenPages":[]}

Advanced usage

Other

Quick start

I want to start like right now!

1. Download ocLazyLoad.js. It can be found in the 'dist' folder of the git repository. You can also install it with `bower install oclazyload` or `npm install oclazyload`.
2. Add the module `oc.lazyLoad` to your application:
[block:code]
{
"codes": [
{
"code": "var myApp = angular.module(\"MyApp\", [\"oc.lazyLoad\"]);",
"language": "javascript",
"name": "Add the module to your application"
}
]
}
[/block]
3. Load on demand:
[block:code]
{
"codes": [
{
"code": "myApp.controller(\"MyCtrl\", function($ocLazyLoad) {\n\t$ocLazyLoad.load('testModule.js');\n});",
"language": "javascript",
"name": "Basic example to load a module"
}
]
}
[/block]
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!