Angular 2 - Insert Http into a class (model)
<p>I'd like to have a model that updates the back-end by itself but when I import Http it is undefined.</p>

<pre><code>    import {Http, Headers} from "@angular/http";

        export class Vehicle {
          engine:string
          id:number

          constructor(private http:Http){
          }

          update() {            
            const body = JSON.stringify(engine);
            const headers = new Headers();
            headers.append('Content-Type', 'application/json');
            return this._http.put('http://localhost/v1/vehicles/' + id, body, {headers: headers})
                .map(response =&gt; response.json());
          }

        }
</code></pre>

<p>The idea then is to do something like:</p>

<pre><code>var vehicle = new Vehicle();
vehicle.update(); //this then would update the back end
</code></pre>

<p>I've simplified the class to show what I'm after (not worried about the syntactical correctness necessarily in the above example). </p>

<p>In this scenario, it transpiles correctly and there are no errors <strong>BUT http is undefined.</strong> </p>

<p>I can achieve what I want in an ng2 service by getting the contents of the vehicle instance and then passing them onto the VehicleList service but was wondering if it's possible to do it right in the Vehicle class itself. </p>