title: How to get image and show in my page angular 6
body: <p>I'm saving image from uploader into database so it's working perfect for me but the question is if I want to show that image in my website so how can I show them and also image path should be shown like <code>src="http://www.example.com/image.png"</code>.
  Please give me any example/solution for it. </p>
  
  <p>TS</p>
  
  <pre><code>imageUrl: string = "/assets/img/default-image.png";
    fileToUpload: File = null;
    constructor(private imageService: ImageUploadService) { }
  
    handleInputFile(file: FileList){
      this.fileToUpload = file.item(0);
      var reader = new FileReader();
      reader.onload = (event:any) =&gt; {
        this.imageUrl = event.target.result;
      }
      reader.readAsDataURL(this.fileToUpload);
    }
  
    OnSubmit(Caption,Image){
      this.imageService.postFile(Caption.value, this.fileToUpload).subscribe(
        data =&gt; {
          console.log("Done");
          Caption.value = "";
          Image.value = "";
        }
      );
    }
  </code></pre>
  
  <p>Service.Ts</p>
  
  <pre><code>postFile(caption: string, fileToUpload: File){
      const endpoint = 'http://localhost:3343/api/UploadImage';
      const formData: FormData = new FormData();
      formData.append("Image", fileToUpload, fileToUpload.name);
      formData.append("Caption", caption);
      return this.http.post(endpoint,formData);
    }
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;form #imageForm="ngForm" (ngSubmit)="OnSubmit(Caption,Image)"&gt;
          &lt;div class="input-field col s12"&gt;
            &lt;input type="text" #Caption ngModel name="Caption" id="Caption"&gt;
            &lt;label for="Caption"&gt;Caption&lt;/label&gt;
          &lt;/div&gt;
          &lt;img [src]="imageUrl" style="width:200px;height:200px;"&gt;
          &lt;input type="file" #Image accept="Image/*" (change)="handleInputFile($event.target.files)"&gt;
          &lt;button class="btn waves-effect waves-light" type="submit"&gt;Submit
            &lt;i class="material-icons right"&gt;send&lt;/i&gt;
          &lt;/button&gt;
        &lt;/form&gt;
  </code></pre>