I have Angular 7 with Material table:
<mat-table #table [dataSource]="dataSource" matSort>
<ng-container matColumnDef="Extension">
<mat-header-cell *matHeaderCellDef (click)="sortData('agentExtn')" class="pointer" [ngClass]="getSortClass('agentExtn')" id="ExtnHeader" >
{{ ExtnHeader | translate }} <div></div >
</mat-header-cell> <mat-cell *matCellDef="let element" class="ExtnCol"> {{ element.Extn }} </mat-cell>
</ng-container>
<ng-container matColumnDef="Play">
<mat-header-cell *matHeaderCellDef>{{ 'MAIN.PLAY' | translate }}</mat-header-cell>
<mat-cell *matCellDef="let element">
<button id="play" class="float-right icon-link" mat-icon-button matTooltip="{{ 'MAIN.PLAY' | translate }}" (click)=" $event.stopPropagation(); playRecord(element.recordId)" >
<i class="fa fa-play" aria-hidden="true"></i>
</button>
</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns" [ngClass]="{ 'highlight-row': selectedRow == row.MediaRecord.$.recordId, pointer: true }" (click)="showRecordDetailsDialog(row)">
</mat-row>
</mat-table>
So rows looks similar to following:
On the click of the Play icon, an audio element is displayed somewhere else on the screen.
Now, I want the Play icon of that particular row to replaced by Pause icon. Also, if the user clicks Play icon of another row, the previous row with Pause icon should be replaced by Play icon.
How can I do this? How can I get reference to the particular rows and replace those particular icons?