Skip to content

Instantly share code, notes, and snippets.

@danic85
danic85 / gist:d56e11650783e7fd6f635e962da3d79b
Created November 23, 2016 10:16
Control visibility of lightning component using slds-hide
<!-- Component Markup -->
<div aura:id="yourIdentifier">
<c:Your_Component />
</div>
/**
* Controller Method
*/
showComponent : function (component, event, helper) {
$A.util.removeClass(component.find("yourIdentifier"), "slds-hide");
@danic85
danic85 / gist:de627813450c9b5a8b176c11c6b4e0e6
Last active November 23, 2016 13:40
Lightning Select component markup with select inside iteration.
<aura:attribute name="selectOptions" type="object[]" description="A list of objects with value (ID) and text (label) attributes"/>
<aura:attribute name="selectedOption" type="ID" default="" description="The value of the selected option"/>
<lightning:select name="selectName" label="My Select" value="{!v.selectedOption}" onchange="{!c.doSomething}" required="true">
<aura:iteration items="{!v.selectOptions}" var="option">
<option value="{!option.value}" selected="{!if(v.selectedOption==option.value,'selected','')}">{!option.text}</option>
</aura:iteration>
</lightning:select>