You need to convert the list of strings a bit, just, just put the array through a function that creates and returns a new array for display
PLUNKR of my example below
Example
my-comp.component.ts
items: any[] = ["item1","item2","item3","item4","item5","item6","item7","item8","item9"];
buildArr(theArr: String[]): String[][]{
var arrOfarr = [];
for(var i = 0; i < theArr.length ; i+=4) {
var row = [];
for(var x = 0; x < 4; x++) {
var value = theArr[i + x];
if (!value) {
break;
}
row.push(value);
}
arrOfarr.push(row);
}
return arrOfarr;
}
my-comp.component.html
<table id="myTable" class="table">
<thead>
<tr>
<th>Item1</th>
<th>Item2</th>
<th>Item3</th>
<th>Item4</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let row of buildArr(items)">
<td *ngFor="let item of row">{{item}}</td>
</tr>
</tbody>
</table>
source
share