I have a table in which I want the first column to take a specific color according to a variable in my class. For example, I have a class DisplayProject.ts which has an attribute called indexOfColor
DisplayProject.ts
export class DispalyProject implements OnInit {
ngOnInit(): void {
}
project: Project;
indexOfColor: number = 1; // can be 2
constructor () {
}
}
DisplayProject.html
<table>
<thead>
<tr>
<th>the project name</th>
<th>the project date</th>
</tr>
</thead>
<tbody>
<tr>
<td>project.name</td>
<td>project.date</td>
</tr>
</tbody>
</table>
I want the column "the project name" to be green if indexOfColor = 1 and be blue if indexOfColor = 2
Any solutions ?