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
Bhupendra yadavBhupendra yadav 

Lightning - Passing param on Button click

Hey,

Is there any syntex to pass the parameter along with button click event to client side JS controller from component? just the way we have in VF?

<apex:commandButton value="click Me" action="{!buttonClicked}">
     <apex:param name="parameterName" value="param1" assignTo="{!param}"/>
</apex:commandButton>


On the similar line is there anything like below?

<ui:button press='{!c.buttonClicked}'>
   <ui:param value='pram1'/>
</ui:button>


 
Himanshu ParasharHimanshu Parashar
Hi Bhupendra,

No this is not possible till now. We don't get that in lightning component as we get in VF Page.


Thanks,
Himanshu
Salesforce Certified Developer | Administrator | Service Cloud Consultant

P.S.  If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
 
Riti MahantaRiti Mahanta
I am facing the same problem . How can i pass parameter on a Button Click.
In my scenario I have 2 compoments and they talk  via an Application Event. On clicking of a button on the first Compoment , I need to pass a parameter to the 2nd Compoment via the Event . I am stuck on how to pass the param from the button click ( as mentioned above its not like the way we do in VF pages ) . 

Any pointer/ syntax  would be appreciated. 
Thanks.