title: how to GET request from an api in Angular 7
body: <p>I'm trying to get the JSON using <code>HttpClient</code> in Angular 7. The code works fine but I'm trying to implement the commented lines to get the data directly from the API url and stop using the <code>const IMAGES</code>.</p>
  <pre><code>import { Injectable } from '@angular/core';
  import { HttpClient } from '@angular/common/http';
  
  @Injectable()
  export class ImageService {
  
    // public _url: string = &quot;https://jsonplaceholder.typicode.com/photos&quot;;
    constructor(
      // public http: HttpClient
    ) {}
  
    theImages = [];
    // IMAGES = [];
    getImages(){
      // this.IMAGES = this.http.get(this._url);
     return this.theImages = IMAGES.slice(0);
   }
    getImage(id: number){
      // this.IMAGES = this.http.get(this._url);
      return IMAGES.slice(0).find(image =&gt; image.id == id);
    }
  
  }
  const IMAGES = [
    {
      &quot;albumId&quot;: 1,
      &quot;id&quot;: 1,
      &quot;title&quot;: &quot;accusamus beatae ad facilis cum similique qui sunt&quot;,
      &quot;url&quot;: &quot;https://via.placeholder.com/600/92c952&quot;,
      &quot;thumbnailUrl&quot;: &quot;https://via.placeholder.com/150/92c952&quot;
    },
  ...
  </code></pre>
  <p>error code is:</p>
  <pre><code>error TS2740: Type 'Observable&lt;Object&gt;' is missing the following properties from type 'any[]': length, pop, push, concat, and 25 more.
  </code></pre>