3

How can i call JS(client side controller) function into helper js function. Please show me the code. Thankyou

Danryl Tigol Carpio
  • 639
  • 2
  • 13
  • 25

2 Answers2

3

Danryl,

A Sample Code below.

<aura:component >
    <ui:outputText aura:Id="Hello" value=""/>
    <ui:button label="Click" press="{!c.Click}"/>
</aura:component>

//Controller

({
    Click : function(component, event, helper)
    {

        helper.helperMethod(component,event,sum);
    }
})

//Helper

({
    helperMethod : function(component,sum) 
    {
        var hello=component.find("Hello");
        hello.set("v.value","New Value !!!")

    }
})

As ankuli suggested, refer the trailhead document.

Anitha J J
  • 356
  • 3
  • 13
  • Please check if you have idea about this.

    http://salesforce.stackexchange.com/questions/88770/putting-a-field-values-of-an-object-using-apex

    – Danryl Tigol Carpio Aug 20 '15 at 06:59
  • Hope you can help me in this problem http://salesforce.stackexchange.com/questions/89252/how-to-swap-2-different-component-views-in-lightning?noredirect=1#comment118290_89252 – Danryl Tigol Carpio Aug 25 '15 at 05:17
0

you can call helper js method from client side controller but reverse is not defined anywhere. helper.callMethodOfClinetSideCotnroller(component, parameter1);

Ankuli
  • 670
  • 2
  • 11
  • 27
  • Where can we Study this one.. will you give me a tutorial link for that so that i can deeply understand and study how to use helper . Thank you I really appreciate your will to help. – Danryl Tigol Carpio Aug 14 '15 at 07:24
  • You can use Trail head which will give you knowledge very quickly. and if you want go through deep into lightning. this link is useful https://resources.docs.salesforce.com/sfdc/pdf/lightning.pdf – Ankuli Aug 14 '15 at 07:41
  • Will you give me an example of code that will use a helper, JS( client side controller),apex(server side controller) , and aura componet. Please .. – Danryl Tigol Carpio Aug 14 '15 at 08:04