[SalesForce] Call function in child component from the parent component

I have a child component inside my parent component as below:

<aura:iteration items="{!v.articolo.items}" var="item">
    <c:RigaTabellaItemsKit item="{!item}" PicklistStatoKit_SelVal="{!v.PicklistStatoKit_SelVal}" aura:id="item_in_kit"/>
</aura:iteration>

During some operation inside the Helper of the parent component, I should call a function defined inside the child component.

Helper (Parent):

var pesi_value = component.get("v.pesi");
var articoloKit = component.get("v.articolo");
var itemsInKit = articoloKit.items;
var value1 = 2.0;

for (var i = 0; i < pesi_value.length; i++){
    itemsInKit[i].voce.Prezzo_totale__c = value1 * pesi_value[i];
    //here I should call a function inside the child component.
}

Assume that the function which I want to call is as described inside the Helper of the child as below:

calcolaRicarico : function(component, event, helper) {
    helper.calcolaRicarico(component, event);
}

How could I do that?

Best Answer

you can call using aura:method by using aura:id

<c:RigaTabellaItemsKit  aura:id="item_in_kit"/>

Helper (Parent):

cmp.find("item_in_kit").calcolaRicarico();

In child:

<aura:method name="calcolaRicarico" action="{!c.calcolaRicarico}" />