Skip to content

Instantly share code, notes, and snippets.

@simpluslabs
Last active November 20, 2018 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simpluslabs/16a372cd27046c3f7dc7adc30e3e5a50 to your computer and use it in GitHub Desktop.
Save simpluslabs/16a372cd27046c3f7dc7adc30e3e5a50 to your computer and use it in GitHub Desktop.
<aura:component >
<aura:handler name="init" value="{! this}" action="{! c.doInit}" />
<aura:attribute name="checkValue1" type="Boolean" default="false" />
<aura:attribute name="checkValue2" type="Boolean" default="true" />
<div>
<p>Value of attribute checkValue1 <strong>{! v.checkValue1}</strong></p>
<p>Value of attribute checkValue2 <strong>{! v.checkValue2}</strong></p>
<lightning:button label="Change Value of checkValue1" title="Change value" onclick="{! c.resetCheckValue1 }"/>
<lightning:button label="Change Value of checkValue2" title="Change value" onclick="{! c.resetCheckValue2 }"/>
<aura:if isTrue="{! v.checkValue1}">
<p>
This section is displayed if the if <strong>checkValue1</strong> evaluates to <strong>true</strong>
</p>
<aura:set attribute="else">
<p>
This section is displayed if <strong>checkValue1</strong> if evaluates to <strong>false</strong>
</p>
</aura:set>
</aura:if>
<p>
<Strong>Using logical AND operator</Strong>
<aura:if isTrue="{! and(v.checkValue1, v.checkValue2)}">
<p>
This section is displayed if both the attributes evaluate to <strong>true</strong>.
</p>
<aura:set attribute="else">
<p>
This section displayed if either of the attributes evaluates to <strong>false</strong>.
</p>
</aura:set>
</aura:if>
</p>
<p>
<Strong>Using logical OR operator</Strong>
<aura:if isTrue="{! or(v.checkValue1, v.checkValue2)}">
<p>
This section is displayed if either of the attributes evaluates to <strong>true</strong>.
</p>
<aura:set attribute="else">
<p>
This section displayed if either of the attributes evaluates to <strong>false</strong>.
</p>
</aura:set>
</aura:if>
</p>
</div>
</aura:component>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment