Angular 显示阵列<;对象>;在素描模板中
我有这种JSON:Angular 显示阵列<;对象>;在素描模板中,angular,angular2-template,primeng,angular-datatables,Angular,Angular2 Template,Primeng,Angular Datatables,我有这种JSON: { description: "Some Description", child: [{ description2: "Some Other Description", description3: "Another Description" }] } 我想把它显示在我的Priming数据表上,但它总是显示空白单元格 这是我的列代码 <p-column field
{
description: "Some Description",
child: [{
description2: "Some Other Description",
description3: "Another Description"
}]
}
我想把它显示在我的Priming数据表上,但它总是显示空白单元格
这是我的列代码
<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>
{{child.description2}
有什么解决办法吗?经过一些试验,我找到了解决办法,以下是我的答案:
<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>
小孩
{{child.description2}