You need to sign in to do that
Don't have an account?
Getting error while using nested aura:iteration in lightning component
I am not able to use nested aura:iteration in my lightning component. Please see my lightning component code below. But, I am able to use the nested array directly by using indexing which you can see in 3rd line code.
CoursesDetailsWithOfferings - It contains the following array.
[{courseName: "BCA", courseOfferings:[{Campus_Location__c:"Delhi",Name: "Test1", Start_Date__c: "2017-10-03", End_Date__c: "2019-10-02"}]}, {courseName: "MCA", courseOfferings:[{Campus_Location__c:"Goa",Name: "Test2", Start_Date__c: "2017-11-03", End_Date__c: "2019-11-02"}]}]
Please help me to fix it. Thanks in advance!!!!!
<aura:iteration items="{!v.CoursesDetailsWithOfferings}" var="courseDetail"> <li id="{!courseDetail.courseName}">{!courseDetail.courseName}</li> <span>{!courseDetail.courseOfferings[0].Campus_Location__c}</span> <aura:iteration items="{!courseDetail.courseOfferings}" var="courseOffering"> <span id="{!courseOffering.Campus_Location__c}">{!courseOffering.Campus_Location__c}</span> </aura:iteration> </aura:iteration>Please check my JSON data which I am getting in the helper.
CoursesDetailsWithOfferings - It contains the following array.
[{courseName: "BCA", courseOfferings:[{Campus_Location__c:"Delhi",Name: "Test1", Start_Date__c: "2017-10-03", End_Date__c: "2019-10-02"}]}, {courseName: "MCA", courseOfferings:[{Campus_Location__c:"Goa",Name: "Test2", Start_Date__c: "2017-11-03", End_Date__c: "2019-11-02"}]}]
Please help me to fix it. Thanks in advance!!!!!
Please check the following sample code. You need to define your attribute properly.
App: Component: Controller: Lightning Server Side Controller: Data Classes: Hope this helps.
Kindly mark this as solved if it's resolved so that it will be helpful for others who are facing the same issue.
Thanks,
Nagendra