I\'m wondering what the best way is to map the http response from a get request to a class instead of a basic Javascript object.
In my current attempt I simple do
I think that you could use the map method of JavaScript objects:
map
getHeroes () { return this.http.get(this._heroesUrl) .map(res => { return res.json().data.map((elt) => { // Use elt to create an instance of Hero return new Hero(...); }); }) .catch(this.handleError); }