Reputation: 3137
I need this html
<div>
<div>1</div>
<div>2</div>
<div>3</div>
<div class="last">4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div class="last">8</div>
<div>
I am using this function
<div class="col-md-3"
ng-repeat="items in data.data"
data-ng-class="{'last': $index%3 == 0 && $index!=0}" >
But i m getting this output
<div>
<div>1</div>
<div>2</div>
<div>3</div>
<div class="last">4</div>
<div>5</div>
<div>6</div>
<div class="last">7</div>
<div>8</div>
<div>
Upvotes: 0
Views: 50
Reputation: 3137
Finally i got the solution
{'last': ($index+1) % 4 == 0 && $index!=0}
@Ben Black comments helped me.
Edit suggested {'last': ($index+1) % 4 == 0 } because $index never be zero This solution might help others
Upvotes: 0
Reputation:
Use 4
, not 3
if you want the rows with index divisible by four.
{'last': ($index + 1 ) % 4 == 0 && $index != 0}
Upvotes: 1