title: Typescript Angular 2 How do I return JSON data from a service to a component?
body: <p>I'm getting an error <code>Type 'void' is not assignable to type 'Image[]'</code> for the following code. </p>
  
  <p>How do I return the json data in <code>image.service.ts</code> so that  <code>app.component.ts</code> is getting an array of Image[] types?</p>
  
  <p>app.component.ts</p>
  
  <pre><code>  images: Image[];
  
    getImages() {
       this.images = this._imageService.getImageData();
     }
  </code></pre>
  
  <p>image.service.ts</p>
  
  <pre><code>  getImageData() {
      this._http.get('app/test.json').subscribe(res =&gt; {
        return res.json();
      })
    }
  </code></pre>
  
  <p>app/test.json</p>
  
  <pre><code>[{"id":"1","imageid":"1","imageurl":"http://imageur"}]
  </code></pre>