在 PrimeNg 模板中显示数组 <Object>
Display Array<Object> in PrimeNg template
我有这种JSON:
{
description: "Some Description",
child: [{
description2: "Some Other Description",
description3: "Another Description"
}]
}
我想在我的 PrimeNg DataTable 上显示它,但不知何故它总是显示空白单元格。
这是我的专栏代码
<p-column field="child" header="Child">
<ng-template let-col let-item="rowData" pTemplate="body" >
<tr ngFor="let child of item.child">
<td>
{{child.description2}}
</td>
</tr>
</ng-template>
</p-column>
有解决办法吗?
经过一些尝试,我找到了解决方案,这是我的答案:
<p-column>
<ng-template pTemplate="header">Child</ng-template>
<ng-template let-col let-childs="rowData.child" pTemplate="body" >
<tr *ngFor="let child of childs">
<td>{{child.description2}}</td>
</tr>
</ng-template>
</p-column>
我有这种JSON:
{
description: "Some Description",
child: [{
description2: "Some Other Description",
description3: "Another Description"
}]
}
我想在我的 PrimeNg DataTable 上显示它,但不知何故它总是显示空白单元格。
这是我的专栏代码
<p-column field="child" header="Child">
<ng-template let-col let-item="rowData" pTemplate="body" >
<tr ngFor="let child of item.child">
<td>
{{child.description2}}
</td>
</tr>
</ng-template>
</p-column>
有解决办法吗?
经过一些尝试,我找到了解决方案,这是我的答案:
<p-column>
<ng-template pTemplate="header">Child</ng-template>
<ng-template let-col let-childs="rowData.child" pTemplate="body" >
<tr *ngFor="let child of childs">
<td>{{child.description2}}</td>
</tr>
</ng-template>
</p-column>