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
    }
})
3

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

an @AuraEnabled method has to be static.

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.