Ng-Repeat array to rows and columns

前端 未结 5 1827
梦谈多话
梦谈多话 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:26

    If all of your items are in one single array, your best bet is to make a grid in CSS. This article should be helpful: http://css-tricks.com/dont-overthink-it-grids/

    You can use $index from ng-repeat to apply the correct class for your column (in this case a 4 column grid):

    If you have a 2 dimensional array (split into rows and columns) that opens up more possibilities like actually using an HTML table.

提交回复
热议问题