I am trying to write a list that show 5 items then some additional content then the next 5 items in the list and keep doing this until the list has finished using ng-repeat.
eg
- 1
- 2
- 3
- 4
- 5
- extra content
- 6
- 7
- 8
- 9
- 10
- extra content
- 11
- 12
- 13
- 14
- 15
I have it working with the below example however I want the extra content to appear after every 5 items. Using my method below it would be very manual to implement this if I had for example 100 items in the list. Is there a way to inject a break after every x items in the list using ng-repeat or is there a better way to approach this?
<div ng-app="">
<div ng-init="friends = [
{name:'John', age:25, gender:'boy'},
{name:'Jessie', age:30, gender:'girl'},
{name:'Johanna', age:28, gender:'girl'},
{name:'Joy', age:15, gender:'girl'},
{name:'Mary', age:28, gender:'girl'},
{name:'Peter', age:95, gender:'boy'},
{name:'Sebastian', age:50, gender:'boy'},
{name:'Erika', age:27, gender:'girl'},
{name:'Patrick', age:40, gender:'boy'},
{name:'Samantha', age:60, gender:'girl'}
]">
<ul class="example-animate-container">
<li ng-repeat="friend in friends | limitTo: 5">
[{{$index}}] {{friend.name}} is {{friend.age}} years old.
</li>
<li>extra content</li>
<li ng-repeat="friend in friends | limitTo: 10" ng-if="$index > 5">
[{{$index}}] {{friend.name}} is {{friend.age}} years old.
</li>
</ul>
</div>
</div>