title: AngularJS - Injecting factory from another module into a provider
body: <p>I have a factory from a separate module that I would like to inject into a provider for my module, but I keep getting unknown provider errors. What am I doing wrong?</p>
  
  <p>What I would like to inject:</p>
  
  <pre><code>var angularSocketIO = angular.module('socketioModule', []);
  angularSocketIO.factory('socketio', [
      '$rootScope', 
      'addr', 
      function($rootScope, addr) {
          var socket = io.connect(addr,{
              'sync disconnect on unload': true
          });
                  ...
          return socket;
      }
  ]);
  </code></pre>
  
  <p>Where I am trying to inject it:</p>
  
  <pre><code>angular.module('myApp.services', ['socketioModule'])
      .provider('greeter', ['socketio', function(socket) {
          var salutation = 'Hello';
          this.setSalutation = function(s) {
              salutation = s;
          }
  
          function Greeter(a) {
              this.salutation = salutation;
              socket._emit('hello')
  
              this.greet = function() {
                  return salutation + ' ' + a;
              }
          }
  
          this.$get = function(version) {
              return new Greeter(version);
          };
      }]);
  </code></pre>
  
  <p>That results in </p>
  
  <pre><code>Error: [$injector:modulerr] Failed to instantiate module myApp due to:
  [$injector:modulerr] Failed to instantiate module myApp.services due to: 
  [$injector:unpr] Unknown provider: socketio
  </code></pre>