title: Converting httpClient answer to model objects [Angular 6]
body: <p>I have a question about the Angular 5 httpClient.</p>
  
  <p><strong>This is a model class with a method foo() I'd like to receive from the server</strong></p>
  
  <pre><code>export class MyClass implements Deserializable{
    id: number;
    title: string;
  
    deserialize(input: any) {
      Object.assign(this, input);
      return this;
    }
  
    foo(): string {
      // return "some string conversion" with this.title
    }
  }
  </code></pre>
  
  <p>This is my service requesting it:</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { HttpClient } from '@angular/common/http';
  import { Observable } from 'rxjs';
  import { MyClass } from './MyClass';
  
  @Injectable({
    providedIn: 'root',
  })
  export class MyClassService {
  
    constructor(private http: HttpClient) {
    }
  
    getMyStuff(): Observable&lt;MyClass[]&gt; {
      // this is where I hope to convert the json to instances of MyClass
      return this.http.get&lt;MyClass[]&gt;('api/stuff')
    }
  }
  </code></pre>
  
  <h1>My Problem</h1>
  
  <p>When I ask the service for instances of <code>MyClass</code> I get the data, but I cannot run <code>{{ item.foo() }}</code> in the template. Also, when I <code>console.log()</code> the <code>typeof</code> of an item where it is received in the service, I <strong>do no see</strong> instances of an object of <code>MyClass</code>.</p>
  
  <p><strong>What am I doing wrong?</strong> I thought that writing <code>this.http.get&lt;MyClass[]&gt;('api/stuff')</code> would do the conversion.</p>
  
  <p>Any hints? Thank you in advance!</p>