{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","params":[],"results":{"codes":[]}},"next":{"description":"","pages":[]},"title":"Configuration","type":"basic","slug":"oclazyloadprovider","excerpt":"","body":"You can configure the service provider `$ocLazyLoadProvider` in the config function of your application:\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"angular.module('app', ['oc.lazyLoad']).config(['$ocLazyLoadProvider', function($ocLazyLoadProvider) {\\n\\t$ocLazyLoadProvider.config({\\n\\t\\t// ...\\n\\t});\\n}]);\",\n \"language\": \"javascript\"\n }\n ]\n}\n[/block]\nThe options are:\n[block:parameters]\n{\n \"data\": {\n \"h-0\": \"Option name\",\n \"h-1\": \"Type\",\n \"h-2\": \"Default value\",\n \"0-0\": \"`debug`\",\n \"0-1\": \"Boolean\",\n \"0-2\": \"false\",\n \"1-0\": \"`events`\",\n \"1-1\": \"Boolean\",\n \"1-2\": \"false\",\n \"2-0\": \"`modules`\",\n \"2-1\": \"Array of Objects\",\n \"2-2\": \"*undefined*\"\n },\n \"cols\": 3,\n \"rows\": 3\n}\n[/block]\n\n- `debug`: $ocLazyLoad returns a promise that will be rejected when there is an error but if you set debug to true, $ocLazyLoad will also log all errors to the console.\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"$ocLazyLoadProvider.config({\\n\\tdebug: true\\n});\",\n \"language\": \"javascript\"\n }\n ]\n}\n[/block]\n\n- `events`: $ocLazyLoad can broadcast an event when you load a module, a component or a file (js/css/template). It is disabled by default, set events to `true` to activate it. The events are `ocLazyLoad.moduleLoaded`, `ocLazyLoad.moduleReloaded`, `ocLazyLoad.componentLoaded`, `ocLazyLoad.fileLoaded`.\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"$ocLazyLoadProvider.config({\\n\\tevents: true\\n});\",\n \"language\": \"javascript\"\n }\n ]\n}\n[/block]\n\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"$scope.$on('ocLazyLoad.moduleLoaded', function(e, module) {\\n\\tconsole.log('module loaded', module);\\n});\",\n \"language\": \"javascript\"\n }\n ]\n}\n[/block]\n- `modules`: predefine the configuration of your modules for a later use. You will have to specify the name of the module here so that we can find the reference later.\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"$ocLazyLoadProvider.config({\\n\\tmodules: [{\\n\\t\\tname: 'TestModule',\\n\\t\\tfiles: ['js/TestModule.js']\\n\\t}]\\n});\",\n \"language\": \"javascript\"\n }\n ]\n}\n[/block]\n\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"$ocLazyLoad.load('TestModule'); // will load the predefined configuration\",\n \"language\": \"javascript\"\n }\n ]\n}\n[/block]","updates":["554584f335b2240d00838952","55d3f70fd2c66f0d00497ffb"],"order":0,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"552e88e32594f70d001b2d0a","category":{"sync":{"isSync":false,"url":""},"pages":["552e88e32594f70d001b2d0a","552e88ef06a32a0d009c2f8f","552e89055d4baa0d007836b2","552e8a47a702770d00d96e50"],"title":"API","slug":"api","order":1,"from_sync":false,"reference":false,"_id":"552e88cf5d4baa0d007836b1","version":"552d17dea86ee20d00780b8c","project":"552d17dea86ee20d00780b89","__v":4,"createdAt":"2015-04-15T15:50:39.173Z"},"user":"5519ab08eaa2ed2f002135a0","version":{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["552d17dfa86ee20d00780b8d","552e7d7406a32a0d009c2f7b","552e88cf5d4baa0d007836b1","552e8936a702770d00d96e4d","552e895434565d0d007b4a8d","552e89f82594f70d001b2d0e","552f8a9d8f136c0d005031e9"],"_id":"552d17dea86ee20d00780b8c","project":"552d17dea86ee20d00780b89","releaseDate":"2015-04-14T13:36:30.892Z","__v":7,"createdAt":"2015-04-14T13:36:30.892Z"},"createdAt":"2015-04-15T15:50:59.259Z","project":"552d17dea86ee20d00780b89","__v":10,"githubsync":""}