Is there a way I can utilize the select-option in an Angular select element to alter the css-class of a specific row within an Angular Material table?
I have successfully implemented my selection functionality, where I am able to mark a planet as "selected=true" on select (with all other planets set to false). Now, I am looking to modify the css-class (adding a red border) of the row which contains the object with the "selected" property set to true.
Here is a snippet of my HTML:
<table mat-table [dataSource]="planets" [trackBy]="trackById" class="mat-elevation-z8" id="planetList">
//all ng containers
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row [ngClass]="{'selectedPlanet': planet.selected === 'true'}" *matRowDef="let row; columns: displayedColumns;"></tr>
css:
.selectedPlanet {border-color: red;}
However, I am encountering an error in my console that says something like "ctx_r7.planet is undefined." I am unsure how to correctly use ngClass in this context on a mat table to modify the row. Can anyone provide some guidance on how to solve this issue?