title: angular 7 image display using filepath from api
body: <p>I need to display an image in Angular 7 from an API.
  I can retrieve the image either as form-data or by path of the image.
  So how do I display it in Angular?</p>
  
  <p>I already tried to display an image using its file path but had no success. The code I tried is given below.</p>
  
  <p>TS FILE</p>
  
  <pre><code>this.httpClient.get(`${this.url}`,this.httpOptions)
    .subscribe(data =&gt; {
      this.image=data['filePath'];
      this.finalImage = this.sanitizer.bypassSecurityTrustUrl(this.image);
    },
    error =&gt; {
      console.log(error);
    }
  );
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;div&gt; &lt;img src="{{finalImage}}"&gt; &lt;/div&gt;
  &lt;div&gt; &lt;img [src]="finalImage"&gt; &lt;/div&gt;
  &lt;div&gt; &lt;img bind-src="finalImage"&gt; &lt;/div&gt;
  </code></pre>