+ Start a Discussion
Suneel#8Suneel#8 

aura:iteration showing blank values

I am not sure why aura:iteration is displaying blank list of values.I can see that p.id is repeating 5 times but it is showing blank values.Please help Below is my component-ContactItemList.cmp
<aura:component controller="ContactItemListController" >
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:attribute name="contacts" type="Contact[]"/>
	<aura:iteration items="{!v.contacts}" var="p">
        -->{!p.id}
    </aura:iteration>
</aura:component>
Below is my client side controller-ContactItemListController.js
({
	doInit : function(component, event, helper) {
        helper.getContacts(component);
    }
})
Below is my server sider controller-ContactItemListController.apxc
public class ContactItemListController {
	@AuraEnabled
    public static List<Contact> getContacts() {
        List<Contact> cList=[select id from Contact limit 5];
        System.debug('-------->'+cList.size());
        return cList;//[select id, name from contact limit 100];//cList;
    }
}
Below is my helper file-ContactItemListHelper.js
({
 	getContacts: function(component) {
        var action = component.get("c.getContacts");
        action.setCallback(this, function(a) {
            component.set("v.contacts", a.getReturnValue());
            console.log("**"+a.getReturnValue());
        });
        $A.enqueueAction(action);
    }
})






 
Best Answer chosen by Suneel#8
Vinod BirlaVinod Birla
Try {!p.Id}.

All Answers

Vinod BirlaVinod Birla
Try {!p.Id}.
This was selected as the best answer
Suneel#8Suneel#8
Thanks a lot for the timely reply