Display Apex Variables In Lightning Components

When developing Lightning Components on the Salesforce platform a popular need is to simply display values from an apex controller directly on the lightning component.

To help show how to do this I created this example where the lightning component is displaying field values returned form a SOQL query.


  • We create our string and object get;set; variables and a include the @AuraEnabled annotation.
  • The @AuraEnabled annotation enables client- and server-side access to an apex controller method and controller property. Providing this annotation makes your methods and properties available to your Lightning components.
  • In the Apex class LC_controller we have a single method initClass() where the return type is class type / the object itself.




Lightning Component:


Lightning Component Controller JS:


Add Comment