I am using the below code. I am using Angular 12.
<div >
<div >
<div [class.col-sm-4]="true"> </div>
</div>
</div>
When I see the UI, I am not getting col-Sm-4 class attribute there for div. what can be the reason for it ? and how to overcome from it. ?
CodePudding user response:
You can use ngClass for this. For example:
[ngClass]="yourConditionHere == true? 'col-sm-4': '' "