component
<aura:component controller="AudioController">
<aura:attribute name="setMeOnInit" type="String" default="default value" />
<aura:handler name="init" value="{!this}" action="{!c.getRecURL}"/>
<h1>{!v.setMeOnInit}</h1>
</aura:component>
Server controller
public class AudioController {
@AuraEnabled
public static String getRecURLdata() {
Contract c = [SELECT Id, recURL__c FROM Contract WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
return 'hello from cont';
}
}
Client controller
({
"getRecURL" : function(cmp) {
var action = cmp.get("c.getRecURLdata");
action.setCallback(this, function(response) {
cmp.set("v.setMeOnInit", response.getReturnValue());
});
$A.enqueueAction(action);
}
})
These are mostly just test values. I'm trying to get "hello from cont" to show up in the component