How can i pass parameters from lightning app component and access them in java-script controller where I can set or pass them to my event. Or is there a way out how i can know which attribute in my component was clicked inside my js controller.
Actually I am iterating an array in my component and displaying all the iterations in tabular form setting dynamic ids to them, now when a user clicks an idem i want to pass its id and few more attributes to the controller, Can anyone help me with this.
Component
<aura:iteration items="{!v.all}" var="xxx">
<aura:if isTrue="{!xxx != v.search}">
<span class="sub_main_owner_icon">
<img aura:id="{!xxx}" onclick="{!c.loadDetails}" src="/Owner.png" />
</span>
</aura:if>
</aura:iteration>
Controller
loadDetails : function(component, event, helper) {
loadDetails.setParams({
**I want to pass values here from my component**
"xxx": component.get("v.xxx.Id")
"account": component.get("v.xxx.Id")
});
Best Answer
What I do is add a data-* style attribute to the element that is triggering the event.
and then in the handler, pull that id out with
now I don't know (off the top of my head) how cross browser that code is, but it appears to work in Salesforce1.