title: AngularJS inject service into multiple controllers
body: <p>I have defined a service in its own module:</p>
  
  <pre><code>angular.module('foteDatasetsService', [])
    .factory('foteAPIservice', function($http) {
  
      var foteAPI = {};
  
      foteAPI.getDatasets = function() {
        return $http({
          method: 'JSONP',
          url: 'http://localhost:8080/datasets?callback=JSON_CALLBACK'
        });
      }
  
      return foteAPI;
    });
  </code></pre>
  
  <p>In another module, (in another file) I have a controller where I'd like to use it:</p>
  
  <pre><code>angular.module('foteRequests').controller('foteRequestsController',
    ['$scope', function foteRequestsController($scope, foteAPIservice) {
  
      //snip other stuff
  
      $scope.datasets = [];
  
      foteAPIservice.getDatasets().success(function (response) {
        //Digging into the response to get the relevant data
        $scope.datasets = response;
        console.log(response);
      });
  
  ]);
  </code></pre>
  
  <p>I have an init for this module in a file called <strong>init</strong>.js that includes the dependency like this:</p>
  
  <pre><code>'use strict';
  
  angular.module('foteRequests', ['foteDatasetsService']);
  </code></pre>
  
  <p>It doesn't look like it's actually injecting the foteDatasetsService INTO the controller though. If I run the app, I get an error:</p>
  
  <pre><code>Cannot call method 'getDatasets' of undefined
  </code></pre>
  
  <p>So if I force the issue by including the foteDatasetsService in in the controller like this:</p>
  
  <pre><code>angular.module('foteRequests').controller('foteRequestsController', ['$scope',
  'foteDatasetsService', function foteRequestsController($scope, foteAPIservice) {
  ...
  }]);
  </code></pre>
  
  <p>it gives me this error:</p>
  
  <pre><code>Error: [$injector:unpr] Unknown provider: foteDatasetsServiceProvider &lt;- foteDatasetsService
  </code></pre>
  
  <p>EDIT: I want to be able to inject this service into 3 controllers that will need to get this same info.</p>
  
  <p>Any ideas why the factory is not creating the provider? I'm lost on that one...</p>