Try like this.Kindly Modify it according to your apex controller method
Please refer below link which might help you in thishttps://developer.salesforce.com/forums/?id=9060G0000005pEeQAI Hope this helps youLet me know if this helps you by marking it as solved so that it may help others in future.Thanks and Regards<aura:component controller= "picklistvaluesController"
implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction"
access="global" >
<aura:attribute name="picklistvalues" type="string[]" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<lightning:select aura:id="PicklistId" label="Enter Last Class Percentage" name="percent" >
<option value="" text="- None -" />
<aura:iteration items="{!v.picklistvalues}" var="pickval">
<option value="{!pickval}" text="{!pickval}" />
</aura:iteration>
</lightning:select>
</aura:component>
js controller
({
doInit : function(component, event, helper) {
var action = component.get("c.getPicklistvalues");
action.setCallback(this, function(response) {
var Values = response.getReturnValue();
component.set("v.picklistvalues", values);
});
$A.enqueueAction(action);
}
})
2 respuestas