0

I have written a function to download a file on click of a button in a popup. This is the HTML of the popup:

'<div class="modalpopup not-you-popup">' +
          '<div class="dialog-header header-red">' +
          '<h4><b style="color:red">Success</b></h4>' +
          '</div>' +
          'The file has been uploaded successfully<br>' +
          '*Please note that your file will take up to 7 days to process.'+
          '<table>' +
          '<tr><td>Total records</td><td>&nbsp;:&nbsp;</td><td><b>' + totalCount + '</b></td>' +
          '<tr><td>Uploaded records</td><td>&nbsp;:&nbsp;</td><td><b>' + res.successCount + '</b></td>' +
          '<tr><td>Error records</td><td>&nbsp;:&nbsp;</td><td><b>' + res.errorCount + '</b></td>' +
          '</table>' +
          '</div>'+
          (res.errorCount > 0 ? 'Please <a href="javascript:void(0)" (click)="getErrorFile(res.errorRecords)">Click here</a> to download the records with error' : '');

If I click on the link, it asks open xdg-open? instead of downloading the file. In console it also gives warning: sanitizing unsafe URL value javascript:void(0)

  • 1
    You can use a html sanitizer pipe from angular. https://angular.io/api/platform-browser/DomSanitizer – John Jun 20 '19 at 11:46
  • Here is a similar question that might help: https://stackoverflow.com/questions/39628007/angular2-innerhtml-binding-remove-style-attribute/39630507#39630507 – John Jun 20 '19 at 11:47
  • i tried using html sanitizer, it didnt worked for me. May be i am missing something. –  Jun 20 '19 at 11:51
  • @John can u please give me a sample code? –  Jun 20 '19 at 11:52
  • 2
    If you are able to provide a Stackblitz, or format your code and add some more details, it might be easier to help out. – John Jun 20 '19 at 11:53

0 Answers0