Instantly share code, notes, and snippets.

Embed
What would you like to do?
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment