angularangular-materialmat-card

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


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


Solution

  • 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.