Creating an Apex Server-Side Controller
Use the Developer Console to create an Apex server-side controller.
-
Open the Developer Console.
-
Click File | New | Apex Class.
-
Enter a name for your server-side controller.
-
Click OK.
-
Enter a method for each server-side action in the body of the class.
Add the
@AuraEnabledannotation to a method to expose it as a server-side action. Additionally, server-side actions must bestaticmethods, and eitherglobalorpublic. -
Click File | Save.
-
Open the component that you want to wire to the new controller class.
-
Add a
controllersystem attribute to the<aura:component>tag to wire the component to the controller. For example:
See Also