Angular 设置材质表中数组属性中的值
我正在创建一个材质表。数据源的元素具有数组属性。我想在表中的每一列中显示该属性中成员的值,如下面的代码所示。但是,没有显示任何内容。我哪里弄错的 注意:我用来创建多列的ngFor-in-ng容器Angular 设置材质表中数组属性中的值,angular,angular-material,Angular,Angular Material,我正在创建一个材质表。数据源的元素具有数组属性。我想在表中的每一列中显示该属性中成员的值,如下面的代码所示。但是,没有显示任何内容。我哪里弄错的 注意:我用来创建多列的ngFor-in-ng容器 {{vendor.Name} {{成本} {{textValue}} 尝试使用th和td元素,如下所示: <ng-container *ngFor="let vendor of vendors" [matColumnDef]="vendor.Name"> <th mat-he
{{vendor.Name}
{{成本}
{{textValue}}
尝试使用th
和td
元素,如下所示:
<ng-container *ngFor="let vendor of vendors" [matColumnDef]="vendor.Name">
<th mat-header-cell *matHeaderCellDef>{{vendor.Name}}</th>
<td mat-cell *matCellDef="let element">
<span *ngIf="element.Type == 2 else textValue">
<span *ngFor="let cost of element.Cost">
{{cost}}
</span>
</span>
<ng-template #textValue>
<span *ngFor="let textValue of element.TextValue">
{{textValue}}
</span>
</ng-template>
</td>
</ng-container>
{{vendor.Name}
{{成本}
{{textValue}}
尝试使用th
和td
元素,如下所示:
<ng-container *ngFor="let vendor of vendors" [matColumnDef]="vendor.Name">
<th mat-header-cell *matHeaderCellDef>{{vendor.Name}}</th>
<td mat-cell *matCellDef="let element">
<span *ngIf="element.Type == 2 else textValue">
<span *ngFor="let cost of element.Cost">
{{cost}}
</span>
</span>
<ng-template #textValue>
<span *ngFor="let textValue of element.TextValue">
{{textValue}}
</span>
</ng-template>
</td>
</ng-container>
{{vendor.Name}
{{成本}
{{textValue}}
你能在问题中添加供应商的json吗?你能在问题中添加供应商的json吗?好的,让我试试好的,让我试试