3

I when I press button, I get a lightning alert popup with an error:

Unfortunately, there was a problem. Please try again. If the problem continues, get in touch with your administrator with the error ID shown here and any other related details.Something has gone wrong. Cannot read property '$getActionDef$' of undefined. Please try again.

Apex:

public class AuraCtrl {    
    @AuraEnabled
    public String getFoo() {
        return 'OLOLO';
    }    
}

Lightning:

<aura:component controller="AuraCtrl" implements="force:appHostable,flexipage:availableForAllPageTypes">
    <aura:attribute name="barAttr" type="String"/>
    <ui:inputText aura:id="barId" label="Bar input" value="{!v.barAttr}"/>
    <ui:button label="Press for Bar!" press="{!c.doGetBar}"/>
</aura:component>

JS Ctrl:

({
    doGetBar : function(component, event) {
        var action = component.get("c.getFoo");
        // another code does not matter because all breaks with first line
    }
})

1 Answer 1

3

https://developer.salesforce.com/forums/?id=906F0000000MLprIAG

an @AuraEnabled method has to be static.

You must log in to answer this question.

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