I have 3 modules with the following structure
- app.js
- module.js
- sub-module.js
- module.js
app.js
(function(ng, module){
module.config([function(){
console.log('main app');
}]);
}) (angular, angular.module('app', ['module']));
module.js
(function(ng, module){
module.config(['service', function(service){
console.log('module');
}]);
}) (angular, angular.module('module', ['sub-module']));
sub-module.js
(function (ng, module) {
module.factory('service', [function () {
console.log('test');
return {};
}]);
})(angular, angular.module('sub-module', []));
index.html
<html ng-app="app">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js"></script>
<script src="app.js"></script>
<script src="module.js"></script>
<script src="sub-module.js"></script>
</head>
<body>
<h1>Hello Plunker!</h1>
</body>
</html>
plnkr: http://plnkr.co/edit/8BHhpZHrIYpTd5gn0IsZ?p=preview
I am encountering this error in the console: Uncaught Error: [$injector:modulerr]
Can anyone help me identify what is causing this issue with the injector?