Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bolaurent
Created November 28, 2017 09:11
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 bolaurent/9b5b35bd0d2dab46cd138037ee1add7d to your computer and use it in GitHub Desktop.
Save bolaurent/9b5b35bd0d2dab46cd138037ee1add7d to your computer and use it in GitHub Desktop.
auraIfAdvanced (salesforce lightning component)
<aura:documentation>
<aura:description>Documentation</aura:description>
<aura:example name="ExampleName" ref="exampleComponentName" label="Label">
<!--
<c:auraIfAdvanced list="["a","b","c"]" element="b">
WhateverU_NeedHere
</c:auraIfAdvanced>
-->
</aura:example>
</aura:documentation>
<aura:component>
<aura:handler name="init" value="{!this}" access="global" action="{!c.doInit}" />
<aura:attribute name="list" type="Object[]" />
<aura:attribute name="element" type="String" />
<aura:attribute name="condition" type="Boolean" default="false" />
<aura:if isTrue="{!v.condition}">
{!v.body}
</aura:if>
</aura:component>
({
doInit: function(component, event, helper) {
if (component.get('v.list').indexOf(component.get('v.element')) > -0 )
component.set('v.condition',true);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment