sri harsha
sri harsha

Reputation: 55

how to loop class name by *ngFor using angular10

columnClass: string[] = ['name', 'email', 'phn', 'city', 'state', '', 'w-40'];

<td *ngFor="let col of columnClass" class="pr-20 {{col}}">

string[] is in one component.ts and html is in another component.html

Upvotes: 0

Views: 100

Answers (1)

Adam Specker
Adam Specker

Reputation: 422

You need to bind to the class to use variables inside of it.

<td *ngFor="let col of columnClass" class="pr-20" [class]="col">

Upvotes: 1

Related Questions