title: angularjs defining services for the same module in different files
body: <p>I have two files in which I define services in my angular app, but when I try to use them both in my directive, I get an error saying the service provider is not found for whichever directive I define second. It seems like one service is overwriting the other. If I change the module definition in service2.js to myapp.services2, then it works. I would think I could add multiple factories to the same module this way. Can someone point out what I'm doing incorrectly?</p>
  
  <p>service1.js:</p>
  
  <pre><code>var services = angular.module('myapp.services',[]);
  services.factory('Service1', function() {
      // service code
  });
  </code></pre>
  
  <p>service2.js:</p>
  
  <pre><code>var services = angular.module('myapp.services',[]);
  services.factory('Service2', function() {
      // service code
  });
  </code></pre>
  
  <p>mydirective.js:</p>
  
  <pre><code>angular.module('myappdirective', []).directive('myapp', ['Service1', 'Service2',
  function(service1,service2) {
      // directive code
  }]);
  </code></pre>