I'm translating massive excel spreadsheets into json, then building a tool to format the data and utilize it for analysis.
In the upload process, i'm presenting the user with a view of all their data. I'm having some trouble formatting the tables though and i'm hoping someone here can help explain the problem:
When using standard data tables in html i can get my desired result easily when hardcoding it:
<div style="margin-bottom: 10px">
<table class="table table-responsive table-condensed">
<tr>
<th style="color: black" *ngFor="let label of lineChartLabels">{{label}}</th>
</tr>
<tr *ngFor="let d of XLSData">
<td>This is in Column 1</td>
<td>And this is in Column 2</td>
</tr>
</table>
</div>
And i get this:
But when filling the rows with NgFor i get the data repeated for every column:
<div style="margin-bottom: 10px">
<table class="table table-responsive table-condensed">
<tr>
<th style="color: black" *ngFor="let label of lineChartLabels">{{label}}</th>
</tr>
<tr *ngFor="let d of XLSData">
<td style="color: black" *ngFor="let label of lineChartLabels">Time: {{d.Time | json}}</td>
<td style="color: black" *ngFor="let label of lineChartLabels">Empty: {{d.__EMPTY | json}}</td>
</tr>
</table>
</div>
I don't understand why the loop fills up every column available with the same data, as the data does not repeat in the JSON array.
