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, 2018 at 21:42
  • adding to @glls comment - please share also the whole markup Feb 14, 2018 at 8:07

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .