title: Inject a Factory in AngularJS using Typescript
body: <p>So in plain old Angular, you would inject a Factory like so:</p>
  
  <pre><code>(function(angular){
      "use strict";
  
      var app = angular.module('app', []);
      app.factory('MyFactory', ['$http', function($http) {
      ....
      });
  }());
  </code></pre>
  
  <p>Now using Typescript, I am trying to use the <code>$inject</code> like so:</p>
  
  <pre><code>module Services {
      export class MyFactory {
          static $inject = ['$http'];
          constructor(private $http: ng.IHttpService) {
          }
      }
  }
  
  var app = angular.module('app', []);
  
  app.factory('MyFactory', Services.MyFactory) //&lt;-- This does not work, never is instantiated.
  
  app.factory('MyFactory', ['$http', Services.MyFactory]); //&lt;-- No deal, it has constructor dependencies
  
  // Seems you have to do this
  app.factory('MyFactory', ['$http', ($http) =&gt; new Services.MyFactory($http)]);
  </code></pre>
  
  <p>What is the correct way to inject factories in Angular using Typescript?</p>