Apex code-
public class Controller_Apex {
@AuraEnabled
Public static string callApexmtd(){
return 'Amit kumar';
}
}
component
<aura:component >
<aura:attribute name="Result" type="string" />
<lightning:button label="submit" onclick="{!c.show}" />
</aura:component>
controller:
({
show : function(component, event, helper) {
var abc=component.get("c.callApexmtd");
abc.setcallback(this,function(response)
{
var state=response.getstate();
console.log('state :' +state);
if(state==='success'){
var result=response.getreturnvalue();
console.log('result' +result);
component.set("v.result",result);
}
});
$A.enqueueAction(abc);
}
})
Application:
<aura:application extends="force.slds" >
<c:component_apex />
</aura:application>
getting this error:
This page has an error. You might just need to refresh it. Unable to find action 'callApexmtd' on the controller of Capita_one:component_apex Failing descriptor: {Capita_one:component_apex}