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
Sandhya D 26Sandhya D 26 

Appending colon based on values from aura iteration

Hi All,

I am appending colon within <aura:iteration> between each values, but the issue is the colon is getting appended even after the last value. i need it till the last value and not after the last value.
<aura:iteration items="{!item.category}" var="category">
                                      <c:Link class="full-width" recordId="{!category.Category_Id__c}" objectApiName="Category__c" label="{!category.Name}"/> 
                                      <aura:if isTrue="{! !empty(item.category)}">
  										  :
 									  </aura:if>
                                      
                                      </aura:iteration>

 
EllEll
<aura:iteration> has an 'index' variable that can be referenced within your tags.
You can use this to render stuff based on the index, in your case as long as the item isn't the 'last' item in the list
<aura:iteration items="{!v.contacts}" var="item" indexVar="index">
  {!index}
  <aura:if isTrue="{!index != v.contacts.length-1}">
    Not Last!
  </aura:if>
  <aura:if isTrue="{!index == v.contacts.length-1}">
    Last!
  </aura:if>
</aura:iteration>