In this blog, I showed the code for show records in the aura component using the table and lightning application with the help of apex controller.
Create an apex file (Name : GetContactController.apxc)
Source Code: GetContactController.apxc
public class GetContactController {
@AuraEnabled
public static List getCon(){
return [Select Id,Name,Email,Phone From Contact Order by Name ASC];
}
}
Create a lightning component (Name: GetContactCmp)
Source Code: GetContactCmp.cmp
Name
Email
Phone
{!con.Name}
{!con.Email}
{!con.Phone}
Source Code: getContactCmpController.js
({
getContactData : function(component, event, helper) {
var action = component.get("c.getCon");
action.setCallback(this,function(response){
var state = response.getState();
if(state == 'SUCCESS'){
var returnData = response.getReturnValue();
component.set("v.getConList",returnData);
}
});
$A.enqueueAction(action);
}
})
Create a lightning application (Name: GetContactApp)
Source Code: GetContactApp.app