ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 281.4k

How to display message excel not identical on angular 7 when press but

Jun 19 2021 11:03 PM

I work on angular 7 app that compare excel file uploaded with schema file excel I have

I face issue I can't display Excel Not Identical when press button upload and excel Not identical

so if excel file not identical or not same file schema I have then

when press button upload display message Excel Not Identical that display on console log on ts

so How to do that please

What I have tried:

public uploadFile = (files) => {
   
 this._dataService.CompareExcel(this.selectedoptions.toString(),this.fileToUpload)
 .subscribe(resp => {
  if (resp) {
    console.log('Excel is Identical');
   if(this.selectedoptions==1)
 {
 this._dataService.PostUpload(this.selectedoptions.toString(),this.fileToUpload)
 .subscribe((response: Blob) => saveAs(response, this.fileToUpload.name + '.xlsx'));

 }
 if(this.selectedoptions==2)
 {
    this._dataService.PostUploadzip(this.selectedoptions.toString(),this.fileToUpload)
    .subscribe((response: Blob) => saveAs(response, this.fileToUpload.name  + '.zip'));

 }
    
  } else {
    console.log('Excel Not Identical');
    
  }
});

on component.html 

<button (click)="uploadFile(files)" class="btn btn-link" style="margin-right: 0px">
    <nb-icon icon="cloud-upload-outline"></nb-icon>      
</button>