Issue
I'm trying to get an html <br> tag after a determined amount of elements with ng-repeat. As an example every 5th button gets a <br> appended to it. I tried multiple approaches but can't seem to get it right. I'd appreciate if anyone can give me some pointers on how to achieve this. Thanks in advance.
<button type="button" class="btn btn-default btn-small" ng-repeat="item in items"
{{item}}
</button>
Solution
You can check for every fifth element using $index of ng-repeat, after that you can use ng-show directive to show <br /> accordingly
<br ng-show="($index + 1) % 5 == 0" />
Answered By - NTP
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.