I am using mat-table-exporter npm module within Angular 9 to export mat table components.
I am able to export it correctly with test as the name of the exported file.
Previous working code:
<mat-table matTableExporter [dataSource]="dataSource" #exporter="matTableExporter">
<button mat-raised-button (click)="exporter.exportTable('csv', {fileName:'test',
Props: {Author: 'myName'}})">
Export
</button>
I also want to add timestamp in the name of the exported file for which I have written the following code:
New component Code:
exportTable(): void {
this.exporter.exportTable('csv', {
filename: `test-${new Date().toISOString()}`,
Props: {
Author: 'myName'
}
})
}
New HTML Code:
<mat-table matTableExporter [dataSource]="dataSource" #exporter="matTableExporter">
<button mat-raised-button (click)="exportTable()">Export</button>
The above code is throwing an error:
TS2552: Cannot find name 'exporter'.