angular.module('app', [])
.controller('ctrl', ['$scope', function($scope) {
$scope.items = [];
for(var i = 0; i < 10; i++)
$scope.items.push({head1:i, head2:i, head3:i});
$scope.size = 6;
}])
.directive('tables', function(){
return{
restrict: 'E',
scope: {
size: '=',
items: '='
},
controller: function($scope){
$scope.$watch('size', function(){
$scope.tables = [
$scope.items.slice(0, $scope.size),
$scope.items.slice($scope.size, $scope.items.length)
];
});
},
template: `
<table ng-repeat='table in tables' style='float:left'>
<thead>
<tr>
<th ng-repeat='head in [1,2,3]'>Head {{head}}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat='item in table'>
<td ng-repeat='(key, value) in item'>{{value}}</td>
</tr>
</tbody>
</table>`
}
})
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js">
</script>
<div ng-app='app' ng-controller="ctrl">
<div>
size: <input type='text' ng-model='size'/>
</div>
<tables items='items' size='size'/>
</div>