Ng-Repeat array to rows and columns

前端 未结 5 1828
梦谈多话
梦谈多话 2021-02-04 06:45

Thanks for taking the time to read this, I was wondering how I might be able to use ng-repeat to create a grid like box of options. I would like to take an array repeat nth num

5条回答
  •  无人共我
    2021-02-04 07:38

    Sorry for my HAML and Bootstrap3:

    .row
      .col-lg-4
        %div{'ng:repeat' => "item in array.slice(0, array.length / 3)"}
          {{item}}
      .col-lg-4
        %div{'ng:repeat' => "item in array.slice(array.length / 3, array.length * 2/3)"}
          {{item}}
      .col-lg-4
        %div{'ng:repeat' => "item in array.slice(array.length * 2/3, array.length)"}
          {{item}}
    

    There is another version, with possibility to use filters:

    {{item}}

提交回复
热议问题