0

I have a parent component controller from which I am calling a Child controller function using aura:method as described in https://developer.salesforce.com/blogs/developer-relations/2017/04/lightning-inter-component-communication-patterns.html

But now working. Giving the error:

c:WspPOLITICS$controller$save [childComponent.callScoremethod is not a function]

Parent Component

   <aura:component access="global">
   <!--some code-->
      <c:questionSectionPolitic aura:id="childQuestion" />
     <button type="button" aura:id="saveAndReturn" class="slds-button slds-button--neutral slds-button slds-button--brand slds-hide" onclick="{!c.save}" >Save and return
     </button>
 </aura:component>

ParentComponent Controller

save : function(component,helper,event){
  var childComponent = component.find("childQuestion");
  console.log('childComponent-->'+childComponent);
  childComponent.callScoremethod(); }

Child Component

   <aura:component access="global">
   <aura:method name="callScoremethod" action="{!c.calcScore}" access="PUBLIC"></aura:method>
   <!--some code-->
   </aura:component>

Child Controller

calcScore : function(component,event,handler){
 <!Some logic-->
 }
Brav
  • 710
  • 4
  • 16
  • 41

0 Answers0