Home > Blockchain >  Bootstrap col-sm-4 not added to div
Bootstrap col-sm-4 not added to div

Time:10-18

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': '' "

  • Related