{"_id":"552e8a47a702770d00d96e50","version":{"_id":"552d17dea86ee20d00780b8c","project":"552d17dea86ee20d00780b89","__v":7,"createdAt":"2015-04-14T13:36:30.892Z","releaseDate":"2015-04-14T13:36:30.892Z","categories":["552d17dfa86ee20d00780b8d","552e7d7406a32a0d009c2f7b","552e88cf5d4baa0d007836b1","552e8936a702770d00d96e4d","552e895434565d0d007b4a8d","552e89f82594f70d001b2d0e","552f8a9d8f136c0d005031e9"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"githubsync":"","__v":6,"project":"552d17dea86ee20d00780b89","user":"5519ab08eaa2ed2f002135a0","category":{"_id":"552e88cf5d4baa0d007836b1","pages":["552e88e32594f70d001b2d0a","552e88ef06a32a0d009c2f8f","552e89055d4baa0d007836b2","552e8a47a702770d00d96e50"],"version":"552d17dea86ee20d00780b8c","project":"552d17dea86ee20d00780b89","__v":4,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-04-15T15:50:39.173Z","from_sync":false,"order":1,"slug":"api","title":"API"},"updates":["554acfe92fe1e61900ef55f8","58d10d5273d7200f0034e4f3"],"next":{"pages":[],"description":""},"createdAt":"2015-04-15T15:56:55.695Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"As a convenience you can also load dependencies by placing one or more module definitions in the dependency injection block of your module. This will only work for lazy loaded modules:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"angular.module('MyModule', ['pascalprecht.translate', {\\n    files: [\\n        '/components/TestModule/TestModule.js',\\n        '/components/bootstrap/css/bootstrap.css',\\n        '/components/bootstrap/js/bootstrap.js'\\n    ],\\n  \\tcache: false\\n}]);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nOr even simpler (if you don't need to add parameters):\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"angular.module('MyModule', ['pascalprecht.translate', [\\n\\t'/components/TestModule/TestModule.js',\\n  '/components/bootstrap/css/bootstrap.css',\\n  '/components/bootstrap/js/bootstrap.js'\\n]]);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"dependency-injection","type":"basic","title":"Dependency Injection"}

Dependency Injection


As a convenience you can also load dependencies by placing one or more module definitions in the dependency injection block of your module. This will only work for lazy loaded modules: [block:code] { "codes": [ { "code": "angular.module('MyModule', ['pascalprecht.translate', {\n files: [\n '/components/TestModule/TestModule.js',\n '/components/bootstrap/css/bootstrap.css',\n '/components/bootstrap/js/bootstrap.js'\n ],\n \tcache: false\n}]);", "language": "javascript" } ] } [/block] Or even simpler (if you don't need to add parameters): [block:code] { "codes": [ { "code": "angular.module('MyModule', ['pascalprecht.translate', [\n\t'/components/TestModule/TestModule.js',\n '/components/bootstrap/css/bootstrap.css',\n '/components/bootstrap/js/bootstrap.js'\n]]);", "language": "javascript" } ] } [/block]