如何使用angular10通过*ngFor循环类名



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

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

string[]在一个组件.ts中,html在另一个组件.html

您需要绑定到类才能使用其中的变量。

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

最新更新