In my UI, I have a dynamic display of mat-tabs that change in number and data based on values from the backend. These tabs are generated dynamically, and when one is clicked, an ID is passed to a function for processing. I want to be able to identify the specific mat-tab that has been clicked and keep it highlighted until the user navigates to another page.
I attempted to use
mat-tab:active{background-color: #333}
, but it did not work as expected.
<mat-tab-group [selectedIndex]="Index" (selectedTabChange)="tabChanged($event)" style="width:100%" #Tabgroup>
<div *ngFor="let item of items; let last = last;" class="button">
<mat-tab>
<ng-template mat-tab-label>
<span class="XYZ" id="item.Id"
(click)="setmodule(item.Id)">{{item.Name}}</span>
</ng-template>
</mat-tab>
</div>
</mat-tab-group>
No error messages were displayed, but the desired outcome was not achieved.