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

Lightning component, controller function having multiple parameter

Hi Guys,

I am trying to use a single lightnign controller in many place in the component, all the time wherever I am using it will have different parameters,
Please let me know how I can achieve that

Just for better understanding 
////////////////// component ////////////////////////////

<!--Here is the link 1 where I want to show function with param1 as the parameter -->
<a href="#" onclick="{c.Show('param1')}"> Link 1</a>

<!--Here is the link 2 where I want to use same  show function with param2 -->
<a href="#" onclick="{c.Show('param2')}"> Link 1

Thanks in advance
Just to make is more to easy to understand, I will show what I am doing

Here is my component
<aura:attribute name="showA" type="String" default="admin" /> 
<aura:attribute name="showB" type="String" default="help" /> 

<a href="#" data-show="{!v.showP}" onclick="{!}" id="New">Link1</a> 

<a href="#" data-showQ="{!v.showQ}" onclick="{!}"  id="Sent">Link2</a>

Here is the controller
//Now whenever user will click I will get the value of op and op2 accordingly now, but what //is want is to use a single attribute and change the value according to the link.

show: function(component,event,helper) {

        var op =;

       	var op2 = event.currentTarget.dataset.showQ; 

        alert(conole.log(op +':::::::::'+ op2));

Hope it explains well.
James LoghryJames Loghry
To second Abhi's comment, use the dataset attribute.  However, at least in Chrome, dataset properties are ALL lowercase.  So in the above example, event.currentTarget.dataset.showq instead of event.currentTarget.dataset.showQ (The Q should have been lowercase).