Customize ng-repeat in AngularJS for every nth element
You could just use $index
and apply it with ng-if
on <br ng-if="!($index%4)" />
<div class="section">
<div ng-repeat="items in MyList">
<img ng-click="AddPoint($index)" src={{items.image}} />
<span>{{items.currentPoint}}/{{items.endPoint}}</span>
<br ng-if="!(($index + 1) % 4)" />
</div>
</div>
Update
Based on the comment, you just need css for this just clear the float every nth element.
.section > div:nth-of-type(4n+1){
clear:both;
}
Demo
If you are worried about support for older browsers then just add a class on specific condition:-
<div ng-repeat="items in offensiveMasteries" ng-class="{wrap:!($index % 4)}">
and a rule for .section > div.wrap
Demo
ng-repeat, show item every nth time for repeated blocks
you can use this, it's correct for all cases, 4, 12, 20, 28 ...:
ng-if="($index+8) % 8 == 4"
Specifc color to each element of ng-repeat
Use ng-style
like this:
<div ng-repeat="x in details" ng-style="{ 'border-color': colors[$index] }">
<p>{{ x.name }}</p>
<p>{{ x.fcount }}</p>
<p>{{ x.email }}</p>
<p>{{ x.contact }}</p>
<p>{{ x.DOB }}</p>
</div>
Check the working demo: fiddle
How to develop Nth level of nested tabular output by using angular js ng-repeat
You can use this type of a pattern with ng-repeat and ng-include to create a nested grid with an unknown number of nestings.
ng-repeat unknown number of nested elements
Related Topics
Highcharts - Issue About Full Chart Width
Changing Data Content on an Object Tag in HTML
Get Final Size of Background Image
CSS Not Being Applied to Document.Write Text
Fontawesome Fails to Load Fonts Locally and in Electron App
How to Fix the Bootstrap Navbar to the Top After a Div Was Scrolled
Is It Normal to Have Two Elements with Same Id in Two Div Elements with Other Id
Listing Known CSS Classes Using JavaScript
Cannot Dynamically Set Initial Element Translation Before Transition in Same Call Stack
Anchor Tag Download Attribute Not Working :Bug in Chrome 35.0.1916.114
Using JavaScript to Override or Disable Meta Refresh Tag
How to Show the Child Div on Mouse Hover of Parent Div
D3: .Transition() Not Working with Events
How to Make Twitter Bootstrap Submenu to Open on the Left Side
Can Bootstrap (4) Be Integrated Along with Angular Material (2)
Focusing on Nested Contenteditable Element
Jquery/JavaScript CSS("Width")/Check If Style Is Defined in CSS