I am trying to set the options of a lightning combobox component dynamically by using component.set('v.options', myOptions)
as was the case for the now deprecated ui:inputSelect
but it seems not to be working. Is this no longer supported for the combobox?
Markup
<aura:attribute name="myVariable" type="Map" default="{val1:'', val2:''}" />
<aura:attribute name="myOptions" type="List" default="[{label: 'Option 1', value: 'option_1'}, {label: 'Option 2', value: 'option_2'}]" />
<lightning:combobox aura:id="required_input"
required="true" placeholder="-- Select --" />
Controller
let inputCmp = component.find('required_input');
if (inputCmp) {
inputCmp.set('v.label', 'testLabel');
inputCmp.set('v.value', component.getReference('v.myVariable.val2'));
inputCmp.set('v.options', component.getReference('v.myOptions'));
}
The options are not being displayed in the component.