I am relatively new to Lightning and trying to learn it via one of the youtube tutorials and used same code for practice but I am not able to see the data on my Lightning component page. I could not find the reason when the code is exactly the same. Please help. Sharing my component, aura enabled method and JS action code for initialising data on page load. Apex Class:

public class contactlist {
public static List<contact> getcontactlist(){
    List<contact> conlist= New List <contact>([Select ID, Name,lastname,firstname,phone,email from contact where email != null]);
    return conlist;

Component code: 
<aura:component controller="contactlist">
<aura:attribute name="contList" type="contact[]"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:iteration items="{!v.contList}" var="con">

JS Controller code:
doInit : function(component, event, helper) {
    var action= component.get('c.getcontactlist');
        var responsevalue= response.getReturnValue();
        console.log('responsevalue',responsevalue );


1 Answer 1


Check to see if the field names match along with the case .

For instance your lastname should be replaced with Lastname as below .

Compare your data from console.log with the component reference, I was able to print the same by changing lastname to LastName.

      <aura:iteration items="{!v.contList}" var="con">        
  • Thanks a lot, Ezio..!! It worked. It was just due to case-sensitivity...!! silly mistake. Merry Christmas..!! :)
    – Aditya
    Dec 25, 2019 at 18:26

You must log in to answer this question.

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