Creating models in typescript that take injectables
<p>I am creating a user model in typescript, with the following:</p>

<pre><code>import {Inject} from 'angular2/core';
import {Http} from "angular2/http";

export class User {
    firstName:string;
    lastName:string;
    constructor(User:User, @Inject(Http) private _http){
        this.firstName = User.firstName;
        this.lastName = User.lastName;
    }
    getUserFirstName(){
        return this.firstName;
    }

    addUser(){
        return this._http.post('/api/user/',this);
    }
}
</code></pre>

<p>And in other places,I use:</p>

<pre><code>var use = new User(userObject) // where userObject is an object with firstName and lastName
</code></pre>

<p>And this creates object, with two methods: <code>getUsername</code> and  <code>addUser</code>.</p>

<p>However, there is an issue with injecting the <code>http</code>. It is always undefined. Do you have any pointers or solutions to this problem?</p>

<p>Thanks</p>