I want lightning code similar to this C code:
for (int i = 0; i < childs.size(); i++)
{
if (parents[i] == childs[i])
cout << parents[i] << " is a parent of " << childs[i] << endl;
}
I have two attributes for the array, parents and childs and I pull the correct data. I tried this:
<aura:iteration items="{!v.childs}" var="child" indexVar="index">
<aura:if isTrue="{!v.parents[index] == child}" >
{!v.parents[index]} is a parent to child <br></br>
</aura:if>
</aura:iteration>
I figured the indexVar field would be what I wanted but it doesn't seem to be the case.
Map.v.parents[index] == childseems to be saying "parent object is child object" not "is a parent to child". Is there a field you should be comparing e.g.v.parents[index].Id == child.Parent__c? UsingindexVarseems reasonable to me..indexVaras part of an evaluated expression, unfortunately.