I am trying to implement helper method in my lightning component but getting below error.

This page has an error. You might just need to refresh it. Action failed: sree123:calculate$controller$calculateResult [helper.calHelper is not a function] Failing descriptor: {sree123:calculate$controller$calculateResult}.

Please help me out.

Here is my component:


<aura:component controller="AuraCalculations">
    <aura:attribute name="FirstNumber" type="decimal"/>
    <aura:attribute name="SecondNumber" type="decimal"/>
    <aura:attribute name="Result" type="decimal"/>
       <ui:inputnumber value="{!v.FirstNumber}" label="First number"/>
       <ui:inputnumber value="{!v.SecondNumber}" label="Second number"/>
       <ui:inputnumber value="{!v.Result}" label="Result"/>
       <ui:button press="{!c.calculateResult}" label="Calculate" />



    calculateResult : function(component, event, helper) {


Helper Method :calculateAppHelper.js:

    calHelper : function(component) {
        var fnumber = component.get("v.FirstNumber");
        var snumber = component.get("v.SecondNumber");
        //var result = fnumber+snumber;
        var action = component.get("c.calci");



Apex Class - AuraCalculations.aprx :

public class AuraCalculations {
    public static decimal calci(decimal fstNumber,decimal scdNumber){


  • 1
    I suggest you edit your question and post the code with proper formatting. It's not readable that much. Commented May 14, 2018 at 13:16
  • While you post your formatted code, I can see in this version that you are trying to call helper.calHelper(); whereas your function is defined as calHelper : function(component) -- you are missing to pass component from your controller.
    – Jayant Das
    Commented May 14, 2018 at 13:22
  • Hi Jayant, Even after placing component also getting same error
    – user56612
    Commented May 14, 2018 at 13:25

2 Answers 2


From the method definition of calHelper() needs a parameter "component". While calling the method you are not passing it and hence your helper method isnt getting called.

Solution: pass the parameter to helper.

    calculateResult : function(component, event, helper) {


Code working:

enter image description here

  • Yeah i did the same but still getting same error !!
    – user56612
    Commented May 14, 2018 at 13:24
  • @user56612 make sure you refresh/clear cache before trying to run this again
    – Jayant Das
    Commented May 14, 2018 at 13:26
  • I quickly tried your code and got a proper response, that you wanted. As @Jayant mentioned.. You need to refresh your window. I do a hard refresh using CTRL+F5, it works. Commented May 14, 2018 at 13:33
  • Hi Jayant, I cleared cache and tried again but still getting same error.
    – user56612
    Commented May 14, 2018 at 13:34
  • @PranayJaiswal, Let me check once again
    – user56612
    Commented May 14, 2018 at 13:35

You have to write helper logic in component helper(calculateHelper.js). In the above code posted by you, the logic is in calculateAppHelper.js. please move the helper logic from calculateAppHelper.js to calculateHelper.js then it should work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .