Is it possible to pass a list or Set to apex class function (@AuraEnabled) from lightning component. I am getting Error Message "Internal Server Error"
//Initialize the Apex Controller Method to be called
var saveAction = component.get("c.testfunction");
var fruits = ["Apple", "Banana"];
//Pass the parameters to the Apex controller method
saveAction.setParams ({
"pListfruits": fruits
});
saveAction.setCallback(this, function(response) {
alert('@@ response @@ ' + saveAction.getError()[0].message);
});
$A.enqueueAction(saveAction);
Apex Function:
@AuraEnabled
public static void testfunction(list<String> lstfruits) {
System.debug('@@ lstfruits@@' + lstfruits);
}