, , . HTML :
<grid source="data.results" break="5" />
JS :
angular.module('yourApp', [])
.directive('grid', function() {
return {
restrict: 'E',
scope: {
break: '=break',
source: '=source'
},
controller: function($scope) {
var total = Math.ceil($scope.source.length / $scope.break);
$scope.data = new Array(total);
for (var i = 0; i < total; ++i) {
$scope.data[i] = $scope.source.slice(i * $scope.break, (i + 1) * $scope.break);
}
},
template:
'<div class="ui grid">' +
' <div class="row" ng-repeat="row in data">' +
' <div class="column" ng-repeat="item in row">' +
' <div class="ui segment">' +
' {{item.original_title}}' +
' </div>' +
' </div>' +
' </div>' +
'</div>',
replace: true
};
});