'How can i use string interpolation in ngClass in Angular 11?

How can achive it that the class name will be forexample "table1-RED" According to color property.It has color property.(I use not the base material table and this has color property of element.Maybe the angular-material is has also i dont know.I just wanted to say not this the problem).I have more hundred row like this and I want to make it dynamically.Angular 11.

   <table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
    
      <ng-container matColumnDef="id">
        <th mat-header-cell *matHeaderCellDef class="table__header">Id</th>
        <td mat-cell *matCellDef="let element" ngClass="table1-{{element.color}}"  >{{ element.id }}</td>
      </ng-container>


Solution 1:[1]

this is working for me

[ngClass]="'table1-'+ element.color"

Solution 2:[2]

[ngClass]="'table1-'+ element.color"

or

[class]="'table1-'+ element.color"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ghaith Troudi
Solution 2 Jeremy Caney