Aura: How to call an Apex method from Lightning javascript controller

3:47 PM

This post details a basic example to execute an apex method from your lightning javascript controller.

STEP 1:

Create the Apex class. Note the following pointers.
  • The method to be executed from your lightning component has to be annotated with  @AuraEnabled. 
  • The method should be either public or global


STEP 2:

Declare your apex class in your lightning component.

STEP 3:

Call your apex method from your Javascript.


Lightning component code:

0 comments