How would I use AngularJS ng-repeat with Twitter Bootstrap's scaffolding?

前端 未结 5 1994
既然无缘
既然无缘 2020-12-24 12:39

How would I use AngularJS ng-repeat to display the following HTML (Twitter Bootstrap Scaffolding)? Essentially, every third record I need to close the <

5条回答
  •  太阳男子
    2020-12-24 13:11

    Moving on from the more easy answer. I dislike the original solution because of the empty dom elements it produces. This is for 3 divs per row.

    {{field}}

    In function FieldsCtrl($scope):

    $scope.fields.range = function() {
        var range = [];
        for( var i = 0; i < $scope.fields.length; i = i + 3 )
            range.push(i);
        return range;
    }
    

    If you know fields.length you can in place of fields.range() use [0,3,6,9] etc

提交回复
热议问题