Last active
November 23, 2016 13:40
-
-
Save danic85/de627813450c9b5a8b176c11c6b4e0e6 to your computer and use it in GitHub Desktop.
Lightning Select component markup with select inside iteration.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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