You need to sign in to do that
Don't have an account?
ANIL 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>
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>
<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>