angular.js ng-repeat for creating grid

后端 未结 11 2031
终归单人心
终归单人心 2020-11-30 03:22

I\'m trying to create a grid using bootstrap 3 and angularjs.

The grid I\'m trying to create is this, repeated using ng-repeat.

11条回答
  •  借酒劲吻你
    2020-11-30 03:29

    You can simply chunk your array into subarrays of N inside of your controller. Sample code:

    var array = ['A','B','C','D','E','F','G','H'];
    
    var chunk = function(arr, size) {
       var newArr = [];
          for (var i=0; i

    Now in *.html file You simply ng-repeat through the array

    {{item}}

    That workout for me :) Good luck!

提交回复
热议问题