function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sameeer TSameeer T 

How to pass variable from Apex class to lightning Js Controller ?

Raj VakatiRaj Vakati
1. Create a server-side controller in Apex and use the @AuraEnabled annotation to enable access to the controller method.
 
public with sharing class SimpleServerSideController {

    //Use @AuraEnabled to enable client- and server-side access to the method
    @AuraEnabled
    public static String serverEcho(String firstName) {
        return ('Hello from the server, ' + firstName);
    }
}

In addition to using the @AuraEnabled annotation, your Apex controller must follow these requirements.
Methods must be static and marked public or global. Non-static methods aren’t supported.
If a method returns an object, instance methods that retrieve the value of the object’s instance field must be public.
 


Refer this link for more info
 
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/controllers_server_apex.htm