The title says it. I have a function in the controller and I want to access it from renderer. But it doesn't seem to work. I tried to put the function in the helper but it didn't work either.


checkDevelopers : function(component, event, helper){


afterRender : function(component, event, helper){
    this.checkDevelopers(component, event, helper);

Controller methods are only available through the component.get("c.functionName") method. The typical use case would be to put methods you need to use all over the place in the helper script. Also, your afterRender syntax is incorrect, which is why that didn't work either. The parameters are component, helper, not component, event, helper. The following changes should work:

afterRender : function(component, helper){
    helper.checkDevelopers(component, null, helper);
  • Thanks ! Do you know how can I call a helper function from the component itself ? I can't call "c.checkDevelopers" because the function is not in the controller anymore. – osos9 Jan 9 at 15:03
  • @osos9 The helper object passed in to afterRender would allow you to call the method, as demonstrated in the answer. – sfdcfox Jan 9 at 15:04
  • I meant, from the component itself, I called the function and with "{!c.checkDevelopers}. But now it's in the helper, so is there an option to do like "{!h.checkDevelopers}" ? – osos9 Jan 9 at 15:13
  • @osos9 Oh. No, the markup can only call controller methods. – sfdcfox Jan 9 at 15:15

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.