file Saver - UI Angular
==========================
ng.component.ts
----------------
import * as fileSaver from 'file-saver';
downloadTestExcelFile() {
const data = "Excel File column to get Default column name;
const blob = new Blob([data], {type: 'text/csv'});
fileSaver.saveAs(blob, "Downloaded_Custom_file_name");
}
ng.template.html
------------------
<a href="javascript:void(0)" id="downloadTestExcel_id" (click)="downloadTestExcelFile()" class="link">Click here to download FileSaver Test File</a>
No comments:
Post a Comment