title: Angular JS: why the difference between module.config injection and controller injection?
body: <p>This is something that I could not figure out from digging into the AngularJS code, maybe you can help solve the mystery. </p>
  
  <p>To show it, I added a service to AngularJS seed project:</p>
  
  <pre><code>function MyServiceProvider() {
      console.log('its my service');
      this.providerMethod = providerMethod;
  
      function providerMethod() {
          console.log('its my service.providerMethod');
      }
  
      this.$get = $get;
  
      function $get() {
          var innerInjectable = {
               name: 'stam'
          };
          return innerInjectable;
      }
  }
  
  var serviceModule = angular.module('myApp.services', []).
      value('version', '0.1').
      provider('myservice',MyServiceProvider);
  </code></pre>
  
  <p>You can see that this provider exposes $get and a certain 'providerMethod'.</p>
  
  <p>Now, for the injection usage:
  If we call config, we can inject the whole class and get access to the 'outer' provider method:</p>
  
  <pre><code>serviceModule.config(function(myserviceProvider) {
      console.log('myServiceProvider:',myserviceProvider);
      myserviceProvider.providerMethod();
  });
  </code></pre>
  
  <p>But when we inject this to a controller (note the Provider-less name), only the $get return value is exposed:</p>
  
  <pre><code>function MyCtrl1(myservice) {
      console.log('MyCtrl1.myservice =',myservice,myservice.name);
  }
  MyCtrl1.$inject = ['myservice'];
  </code></pre>
  
  <p>Console output follows as it should:
  its my service 
  myServiceProvider: 
  Constructor {providerMethod: function, $get: function}
  its my service.providerMethod 
  MyCtrl1.myservice = Object {name: "stam"} stam </p>
  
  <p>Can any one explain the difference?  The reason?
  many thanks for any thought</p>
  
  <p>Lior</p>
  
  <p>PS: I've seen this technique in angular-ui <a href="https://github.com/angular-ui/ui-router" rel="noreferrer">new</a> ui-router (excellent project!). I need access to the outer provider class to do injection in jasmine and other places - to no avail</p>