[SalesForce] How to pass parameters from component and access them in js controller Lightning App

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.

<img aura:id="{!xxx}" onclick="{!c.loadDetails}" src="/Owner.png" data-id="{!xxx}" />

and then in the handler, pull that id out with

loadDetails: function(component, event, helper){
   var el = event.srcElement;
   var id = el.dataset.id;//id here is from 'data-id' in the element

now I don't know (off the top of my head) how cross browser that code is, but it appears to work in Salesforce1.