I am trying to redefine angular.module multiple times one is for controller and one is for service etc. TestService is a factory which is defined in test.js and i want to use it in current html page.
HTML
<script src="test.js"></script>
<script>
var app = angular.module("myapp", ['TestService']).controller(
"MyController", function($scope, $cookies,TestService ) {
<script>
Now i have another javascript page where i am trying to write a service.
test.js
angular.module("myapp").factory('TestService', function() {
return {
sayHello: function(){
return "Factory says hi;
}
}
});
i am getting the error 'TestService' is not available!