我正在尝试将下面的json加载到primeng数据表中。我在设置列名时遇到问题。
[
{
brinname: "Aamir",
aantalPersonen: "122",
signalenVestiging: [
{
vestiging: "Ranchi",
aantalPersonen: "102",
signalenCode: [
{
signaalCode: "4",
aantalPersonen: "15"
},
{
signaalCode: "5",
aantalPersonen: "15"
} ]
}, {
vestiging: "Bangalore",
aantalPersonen: "82",
signalenCode: [
{
signaalCode: "6",
aantalPersonen: "15"
},
{
signaalCode: "7",
aantalPersonen: "15"
} ]
} ]
},
{
brinname: "Abhinav",
aantalPersonen: "122",
signalenVestiging: [
{
vestiging: "Bangalore",
aantalPersonen: "102",
signalenCode: [ {
signaalCode: "7",
aantalPersonen: "15"
}]
} ]
我的代码在这里:
<p-treeTable [value]="files2" [columns]="cols">
<ng-template pTemplate="body" let-rowNode let-rowData="rowData" let-columns="columns" >
<tr>
<td *ngFor="let col of columns; let i = index">
<p-treeTableToggler [rowNode]="rowNode" *ngIf="i == 0"></p-treeTableToggler>
{{rowData[col.field]}}
</td>
</tr>
</ng-template>
</p-treeTable>
有人可以向我解释我如何在HTML中完成并在打字稿文件中使用。谢谢您的帮助。
应该看起来像这样: