Consider the following table in my template
<mat-table #table [dataSource]="dataSource">
<!--- Note that these columns can be defined in any order.
The actual rendered columns are set as a property on the row definition" -->
<!-- ChangeId Column -->
<ng-container cdkColumnDef="fileName">
<mat-header-cell *cdkHeaderCellDef mat-sort-header> File </mat-header-cell>
<mat-cell *cdkCellDef="let row" (click)="downloadFile(row.SerialNumber)"> <a (click)="downloadFile(row.SerialNumber)">{{row.File}}</a> </mat-cell>
</ng-container>
<!-- DateSubmitted -->
<ng-container cdkColumnDef="fileType">
<mat-header-cell *cdkHeaderCellDef mat-sort-header> File Type </mat-header-cell>
<mat-cell *cdkCellDef="let row"> {{row.FileType}} </mat-cell>
</ng-container>
<!-- ChangeSponsor -->
<ng-container cdkColumnDef="contentType">
<mat-header-cell *cdkHeaderCellDef mat-sort-header> Content Type </mat-header-cell>
<mat-cell *cdkCellDef="let row"> {{row.ContentType}} </mat-cell>
</ng-container>
<mat-header-row *cdkHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *cdkRowDef="let row; columns: displayedColumns;">
</mat-row>
</mat-table>
And the method it's calling in the component class
downloadFile(serialNumber: number): void {
this.fileService.downloadFile(serialNumber);
}
In the above table I'm trying to create a (click) event that calls the downloadFile method, which then calls a method in the service class that sends a file to the browser for the user to download. However in none of the attempts above does it work. So I'm definitely missing something.
Can someone let me know what I'm missing that is not letting this work?
Thanks so much in advance for looking into this.
Edit: I was told this is probably important information, but this is a child component.