I have defined a method in the apex controller like below, I don't get any errors, but when loading the page it says ERROR
Here is the apex method:
public class Address_Penetration_ApexController {
@AuraEnabled
public static integer getAddress_UnitCount() {
List<AggregateResult> count = [select COUNT(Id) from Address__c where Name like '%13750 100 Ave%'];
return Integer.valueOf(count);
}
}
Here is the JS Controller
({
fetchAddress : function(component, event, helper) {
var serverCall = component.get("c.getAddress_UnitCount");
serverCall.setCallback(this, function(response){
var state = response.getState();
if(state === "SUCCESS"){
var count = response.getReturnValue();
console.log(count);
component.set("v.totalUnits", count);
}else
alert(state);
});
$A.enqueueAction(serverCall);
}
})