title: Angular application, services and factories
body: <p>I have the following Angular code:</p>
  
  <pre><code>  var application = angular.module('Application', []);
  
    application.controller('ImageController', function ImageController($scope, $http) {
  
      $http.get('api/images').
        success(function (data, status, headers, config) {
          $scope.images = data;
        }).
        error(function (data, status, headers, config) { });
  
      $scope.vote = function (image) {
  
        $http.post('api/images/{key}/vote', { key: image.Key }).
          success(function (data, status, headers, config) {
          }).
          error(function (data, status, headers, config) {
          });
  
      };
  
    });
  </code></pre>
  
  <ol>
  <li><p>How can I have controllers in different files when they share the same application?
  I suppose I should use define the controller differently that:
  application.controller('ImageController', ...</p></li>
  <li><p>I think I should remove the $http part from the controller, right?
  I was reading about Angular Factories and Services but I am not sure which to use.</p>
  
  <p>My interpretation of a factory is something that delivers services on request.
  At least that is how is usually used in, for example, C#.</p>
  
  <p>But in my example, how should I remove the $http part to a service / factory?</p>
  
  <p>And how to inject it in the Controller?</p></li>
  </ol>