[SalesForce] Lightning combobox options attribute not showing any options!

I am trying to populate the options attribute of the lightning combobox to the values of a component attribute. The channels component attribute has all the values in it, but for some reason it doesn't show up on the combobox. Please advise! Here is the code below:

<aura:attribute name="channels" type="sumchans__Channels__c[]"/>
<lightning:combobox name="channelsCombobox" placeholder="Select channel" options="{! v.channels.Name }" value="{! v.channelName }" variant="label-hidden"/>

Best Answer

You're trying to access an attribute that doesn't exist. options must be a list of value-label pairs. You'll need to set up the values in a separate list:

<aura:attribute name="channelOptions" type="Object[]" />

...

var channelOptions = 
  component
  .get("v.channels")
  .map(function(channel) { return { value: channel.Id, label: channel.Name } });
component.set("v.channelOptions", channelOptions);