I'm trying to implement a css property from the style class of the Aura component based on the value of Aura attribute along with certain other slds class as well, which will be static.
Below are the Aura component and css file snippets that I have used and it's not working:
Aura:
The attribute is kept as true for reference and it's value will be updates based on certian funtoinality in the JSContoller
<aura:attribute name="applycss" type="Boolean" default='true'/>
<div class="{! 'slds-col slds-size_2-of-12' + ' ' + if(v.applycss,'customColor','')}">
Test message
</div>
Css:
.THIS.customColor{
background-color: #71B4FF !important;
}
FYI: inside the class I also tried the below 3 logic but nothing worked.
{! 'slds-col slds-size_2-of-12' + ' ' + if(v.applycss,'duplicateColor','')}
{! 'slds-col slds-size_2-of-12' + ' ' + (v.applycss? 'duplicateColor' : '' )}
{!'slds-col slds-size_2-of-12' & v.applycss? 'duplicateColor' : ''}