I have an array of objects as shown below
let columns = [
{id: 1, columnName: 'Column 1'},
{id: 2, columnName: 'Column 2'},
{id: 3, columnName: 'Column 3'},
{id: 4, columnName: 'Column 4'}
];
My goal is to use Angular's *ngFor directive to generate a table in the following format:
<table>
<tr>
<td>Column 1</td>
<td>Column 2</td>
</tr>
<tr>
<td>Column 3</td>
<td>Column 4</td>
</tr>
</table>
I aim to have two columns per row. I attempted to use *ngFor on <tr>
, but couldn't achieve my desired outcome. Can you guide me on the correct approach to accomplish this?
Thank You :-)