I want something like class = "myClass {{classVar}}"
I am trying to concat class name with variable value in scope but not working.
<div *ngFor="let classVar of classList" >
<span [ngClass]="'myClass' classVar "></span>
</div>
Add a +
and a space:
<div *ngFor="let classVar of classList" >
<span [ngClass]="'myClass ' + classVar"></span>
</div>
You can use it like :
[ngClass]="'myClass' + classVar "
OR
ngClass="myClass {{ classVar }}"
OR
[class]="'myClass' + classVar "
OR
class="myClass {{ classVar }}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With