This question is similar: How to set the options of a dynamically created lightning:select?

but none of the solutions nest the iteration component inside another component..

like so:

Inside Controller:

someFunction(cmp, event, helper) : {
                "lightning:select", { 
                    "messageWhenValueMissing":"Did you forget to select a field?",
                    "value":"-- None --"
                "aura:iteration", {
        function(components, status, errorMessage){
            if (status==="SUCCESS"){
                var selectCmp = components[0];
                var iterationCmp = components[1];
                selectCmp.set("v.body", iterationCmp);
                cmp.set("v.inputValueComponent", selectCmp);
            else if (status==="INCOMPLETE"){
                console.log("No response from server or client is offline.");
                else if (status==="ERROR"){
                    console.log("Error: " + errorMessage);        


Inside Component

<aura:attribute name="inputValueComponent" type="Aura.Component">

<aura:attribute name="picklistValues" type="String[]" default="one, two, three"/>
  • and what seems to be the problem you are facing, errors if any? – glls Feb 13 '18 at 21:42
  • adding to @glls comment - please share also the whole markup – Itai Shmida Feb 14 '18 at 8:07
function (pill) {
   var body= component.get("v.body");
   component.set("v.body", body);

You might have to use push to create components in iteration like above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.