How would I use AngularJS ng-repeat to display the following HTML (Twitter Bootstrap Scaffolding)? Essentially, every third record I need to close the <
To keep view logic out of the controller and have a more re-usable solution, you can create a custom filter that splits the array into row groups:
angular.module('app').filter('group', function() {
/**
* splits an array into groups of the given size
* e.g. ([1, 2, 3, 4, 5], 2) -> [[1, 2], [3, 4], [5]]
*/
return function(array, groupSize) {
return _.groupBy(array, function(val, index) {
return Math.floor(index / groupSize);
});
};
});
And in the view:
{{project}}
To include the hr you can use the ng-repeat start and end points:
{{project}}