title: Using generated Swagger TypeScript Rest Client in Angular2
body: <p>I am working on a Meteor web application using Angular 2 and TypeScript. For using a REST API, I have generated client code with Swagger Codegen. Unfortunately there is no sample on <a href="https://github.com/swagger-api/swagger-codegen/tree/master/samples/client/petstore/typescript-angular2/npm" rel="noreferrer">GitHub</a>, how to use the rest client.</p>
  
  <p>I have an angular 2 view component which is injecting an Angular 2 service (ProductTreeService) and the generated API (both marked as "@Injectable"):</p>
  
  <pre><code>@Component({
      selector: 'panel-product-selection',
      template,
      providers: [ProductTreeService, UserApi],
      directives: [ProductTreeComponent]
  })
  
  export class PanelProductSelectionComponent
  {
      private categoriesProductsTree: Collections.LinkedList&lt;CategoryTreeElement&gt;;
      private productTreeService: ProductTreeService;
      private userApi: UserApi;
  
      constructor(productTreeService: ProductTreeService, userApi: UserApi)
      {
          this.productTreeService = productTreeService;
          this.userApi = userApi;
      }
  
      ngOnInit(): void
      {
          //...
      }
  }
  </code></pre>
  
  <p>While the angular service only is accessable and all is working fine, the application is crashing when I inject UserApi. The only difference between UserApi and ProductTreeService is the constructor: The service has no constructor parameters, the generated <a href="https://github.com/swagger-api/swagger-codegen/blob/master/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts" rel="noreferrer">Api class</a> has:</p>
  
  <pre><code>constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string) {
      if (basePath) {
          this.basePath = basePath;
      }
  }
  </code></pre>
  
  <p>So how can I inject the generated API?</p>