function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ANIL PAKKIANIL PAKKI 

Render and preview the contact list

I am facing the problem with the above trailhead unit and the error is 
The component is missing the 'aura:iteration' component and my code is:
MycontactList.cmp
<aura:component controller = "MyContactListController" implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    <aura:attribute name="recordId" type="Id" />
<aura:attribute name="Account" type="Account" />
<aura:attribute name="Contacts" type="Contact" />
<aura:attribute name="Columns" type="List" />
<aura:handler name="init" value="{!this}" action="{!c.myAction}" />
<force:recordData aura:id="accountRecord"
                  recordId="{!v.recordId}"
                  targetFields="{!v.Account}"
                  layoutType="FULL"
                  />
<lightning:card iconName="standard:contact" title="{! 'Contact List for ' + v.Account.Name}">
    <!-- Contact list goes here -->
    <lightning:datatable data="{! v.Contacts }" columns="{! v.Columns }" keyField="Id" hideCheckboxColumn="true"/>
</lightning:card>
</aura:component>

 
Raj VakatiRaj Vakati
use this code
 
<aura:component controller="MyContactListController">
    //This event handler call the myAction client-side controller to handle initialization
    <aura:handler name="init" action="{!c.myAction}" value="{!this}" />
    //Make the list of contacts accessible to the component
    <aura:attribute name="contacts" type="Contact[]" />
    <ul>
        // iterate over the line list of contacts and display their names
<aura:iteration items="{!v.contacts}" var="contact">
	<li class="minli"> <h3>{!contact.Name}</h3> </li>
</aura:iteration>
	</ul> 
</aura:component>

 
Terry Ulanch 8Terry Ulanch 8
this works, just added the <aura:iteration> block at end of code from the trailhead


<aura:component  controller="MyContactListController"  implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" >

    <aura:attribute name="recordId" type="Id" />
    <aura:attribute name="Account" type="Account" />
    <aura:attribute name="Contacts" type="Contact" />
    <aura:attribute name="Columns" type="List" />
    
    <aura:handler name="init" value="{!this}" action="{!c.myAction}" />
    
    <force:recordData aura:id="accountRecord"
                      recordId="{!v.recordId}"
                      targetFields="{!v.Account}"
                      layoutType="FULL"
                      />
    <lightning:card iconName="standard:contact" title="{! 'Contact List for ' + v.Account.Name}">
        <lightning:datatable data="{! v.Contacts }" columns="{! v.Columns }" keyField="Id" hideCheckboxColumn="true"/>        
    </lightning:card>    

<aura:iteration items="{!v.contacts}" var="contact">
    <li class="minli"> <h3>{!contact.Name}</h3> </li>
</aura:iteration>

    
</aura:component>