Comparing Two Values Using Aura If

<aura:application >
    <aura:attribute name="items" type="List" default="[1,2,3]" />
    <aura:attribute name="current" type="Integer" default="2" />

    <aura:iteration items="{!v.items}" var="item">
        <aura:if isTrue="{!v.current == item}">
            <div>Current: {!item}</div>
            <aura:set attribute="else">
                <div>Not Current: {!item}</div>
            </aura:set>
        </aura:if>
    </aura:iteration>
</aura:application>

Output

Not Current: 1
Current: 2
Not Current: 3

Comments

Popular posts from this blog

Dynamic Standard Datatable Using Fieldset

Lightning Grid Custom Datatable