I have a list of custom class objects. I am using aura:iteration to iterate the list. Now I want to show one of the variable of the class object which in itself is object. For example in Salesforce Classic

<apex:repeat value="{!RequiredStoreActivities}" var="activity">
    <apex:variable value="{!activity.StoreActivityCategory}" var="activityCategory" />
    <div >
        <span ></span>
        <apex:outputText value="{!activityCategory.Store_Activity_Category__c}" />

    <div >
        <ul >
            <apex:repeat value="{!activity.StoreActivities}" var="storeActivity">
                    <apex:outputText value="{!storeActivity.Name}" />

Where RequiredStoreActivities is a class

public class RequiredStoreActivity{

  public final Store_Visit_Activity_Category__c StoreActivityCategory {get; private set;}
  public List<Store_Activity__c> StoreActivities {get; set;}

I have to implement the same in lightning. Can somebody help me in it till now I am able to code the below code

<aura:iteration items="{!v.RequiredStoreActivity}" var="st">
    <aura:renderIf isTrue="{!v.showActivity1}">
        <c:StoreActCategory storeActivityCategory="{!st.StoreActivityCategory}"/> 

Since we cannot use apex:iteration inside apex:iteration. I have passed the value to a component. But on the another component the value is getting undefined

1 Answer 1


Just tried aura:iteration inside the aura:iteration and works great .Here is a sample that clearly shows no harm in using nested aura:iterations

<aura:component >

<aura:attribute name="arrvals" type="integer[]" default="1,2,3,4,5"/>    

   <aura:iteration var="num" items="{!v.arrvals}" aura:id="ipv" indexVar="index">
     <aura:iteration var="num1" items="{!v.arrvals}" aura:id="ip12" indexVar="index">

What you might be missing from my opinion is below

Make sure All your inner varibales are annotated @Aura Enabled

The equivalent of apex:var in lightning is aura:attribute .You can declare aura:attribute to store and retrieve values from same as you do for apex:variable in Visualforce

  • Hi Mohith thanks for your reply. I tried using aura:attribute inside aura:iteration but it's giving me an error of invalid name. Whereas when placed it outside iteration it worked. But I need it inside aura: iteration. Can you please check and tell me the solution. It's very urgent
    – Radhika
    Commented Mar 14, 2016 at 3:48
  • @Radhika Can you post all code you have so i can assist better ? The code that you have provided is not sufficient to put right answer .Share your apex and all lightning component code Commented Mar 14, 2016 at 3:53
  • I have mailed you on [email protected]. can you please check. Thanks
    – Radhika
    Commented Mar 14, 2016 at 4:31

You must log in to answer this question.

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