[SalesForce] aura:if Determined by Custom Label Value

Is it possible to use a custom label (set to "true" or "false") to drive an aura:if condition? For instance, I want to display a banner message about upcoming maintenance. If my custom label was "MaintenanceMessage" and the value was set to "true", would this condition work?

<aura:if isTrue="{!$Label.c.MaintenanceMessage} == true">
    <c:MaintenanceBannerComponent />
</aura:if>

And then setting the label to "false" to no longer show the message?

Best Answer

Yes, its possible to use a custom label in aura:if, you just have minor syntax error, following would work:

<aura:if isTrue="{!$Label.c.FirstLabel == 'your value'}">
    <c:MaintenanceBannerComponent />
</aura:if>

Better place would be to use a custom setting instead of a label, as its much easier to manage.