I am trying to separate my app into different modules and inject the factories in the controllers I think this is very close just need help finding the gap. Any help is appreciated.
index.html
<body ng:app='module_1'>
<script src="js/scripts/module_1.js'"></script>
<script src="js/scripts/dD/module_2.js"></script>
<script src="js/scripts/dD/module_3.js"></script>
module_1.js
angular.module('module_1', ['ngCookies','module_2','module_3'])
module_2.js
angular.module('module_2', [])
.factory('module_2_Fact', ['$scope', function() {
function test () {
return "test"
}
return {
test:test
}
}]);
module_3.js
angular.module('module_3', ['module_2'])
.controller('module_3_Ctrl', ['$scope', function(module_2_Fact) {
console.log(module_2_Fact.test); // == > undefined
}]);
module_2_Fact.test returns Cannot read property 'test' of undefined
it seems like module_3 can not find module_2
module_2would crash due to thetestvariable not being defined$scopeand didn't use it, and didn't specifymodule_2_Fact