How to display specific number of elements from a list in aura component - Salesforce Globe For You
Problem: Need to display specified number of elements from a list instead of displaying all elements.
Solution: There is one attribute 'end' in <aura:iteration> tag which can be used for this purpose.The End attribute species the index(excluding) till which the list should iterate.
The end specifies the number of elements to display:If end is 2,it displays 2 elements and if end is 5 ,it displays 5 elements from the list.
Example:
ListIterator.cmp
<aura:component>
<aura:iteration items="1,2,3,4,5,6,7,8,9" var="num" end="4">
{!num}<br/>
</aura:iteration>
</aura:component>
TestApp.app
<aura:application extends="force:slds">
<c:ListIterator/>
</aura:application>
Output:
when end is change to 6,output is
No comments:
Post a Comment