0

when apply single class binding to mat-card, mat-card class is not binding.

<mat-card cdkDropList [className]="getClassName(item)"><!-- some content--></mat-card>

In this case we wont be able to see class name as mat-card and no style been applied from material.

enter image description here

Akhil
  • 443
  • 1
  • 9
  • 29

1 Answers1

1

Just use the standard [class] binding, e.g.

<mat-card cdkDropList [class]="getClassName(item)">
  <!-- some content-->
</mat-card>

Example based on forked example from docs here.

TotallyNewb
  • 3,884
  • 1
  • 11
  • 16
  • This worked. if class attribute is already existing too, it will append class from function. – Akhil Jun 16 '22 at 09:41