onFileChange()

in frontend/src/app/email-copy/email-copy.component.ts [295:323]


  onFileChange(pFileList: File[]) {
    this.showProgress = true;
    let selectedCampaign: any
    selectedCampaign = this.CAMPAIGN_DATA1.filter((a: any) => a.id === this.id)
    this.fileUploaded = true;
    const reader = new FileReader();

    this.campaignServ.imageUpload(pFileList[0], selectedCampaign[0].data?.workspace_assets?.new_folder_id, event).subscribe((res: any) => {
      reader.addEventListener('load', (event: any) => {
        this.imageSrc = event.target.result;
        this.images.push({ id: 1, image: this.imageSrc });
        this.bulkEmailImageContent = this.images[0].image;
        this.showImagesUploaded = true;
        this.loadEditImageCanvasComponent(this.images[0].image)
      });
      reader.readAsDataURL(pFileList[0]);

      this.saveCampaignId = res;
      // this.editImageSection = true;
      this.files = Object.keys(pFileList).map((key: any) => pFileList[key]);
      this.showProgress = false;

      //this.showGenarateImagedata = true;
      this.showGenarateImageEmaildata = true;
      this._snackBar.open("Successfully upload!", 'Close', {
        duration: 2000,
      });
    })
  }