Display image from Blob

// TS
  getBlobImage() {
    return this.blobService.getBlobImageByName(imageUrl)
      .subscribe({
        next: res => {
          this.createImageFromBlob(res);
          this.isImageLoading = false;
        },
        error: error => {
          console.log("Retrive Operator list error: " + error);
          this.toastr.warning(error.status + "- retrive data error", 'Fail');
          this.isImageLoading = false;
        },
        complete: () => console.log('Observer got a complete notification'),
      });
  }

  createImageFromBlob(image: Blob) {
    let reader = new FileReader();
    reader.addEventListener("load", () => {
      this.imageToShow = reader.result;
    }, false);

    if (image) {
      reader.readAsDataURL(image);
    }
  }

Last updated

Was this helpful?