javascript - Angular JS - How to add extra DIV in ng-repeat -


i have array a=[1,2,3,4,5,6].

using ng-repeat on array, creating 6 divs.

please refer plunker

is there way add 1 more div after each row. after 3 divs want add 1 div.

i looked this example. creating child div. possible create sibling div in ng-repeat

let's try ng-repeat-start & ng-repeat-end.

<div class="example-animate-container">   <div class="square" ng-repeat-start="friend in a">    {{$index}}   </div>   <div ng-if="$index % 3 == 2" ng-repeat-end>     div   </div> </div> 

please note ng-repeat-start directive included since angular 1.2.1.

plnkr demo

ng-repeat: repeat series of elements of "one" parent element

<!--====repeater range=====-->   <any ng-repeat="friend in friends">   </any> <!--====end of repeater range=====--> 

ng-repeat-start & ng-repeat-end: using ng-repeat-start , ng-repeat-end define start point , end point of extended repeater range

<!--====repeater range start here=====--> <any ng-repeat="friend in friends" ng-repeat-start>    {{friend.name}} </any><!-- ng-repeat element not end point of repeating range anymore-->  <!--still in repeater range--> <h1>{{friend.name}}</h1>  <!--html tag "ng-repeat-end" directive define end point of range --> <footer ng-repeat-end> </footer> <!--====end of repeater range=====--> 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -