MAT-表matCellDef问题与映射模型,具有特殊字符

问题描述 投票:1回答:1

我从不同的REST API得到的数据与他们之间的特殊字符和空格字段名。

例如,强似row.DatasetID是这样的:

<ng-container matColumnDef="ID">
    <th mat-header-cell *matHeaderCellDef mat-sort-header>ID</th>
    <td mat-cell *matCellDef="let row">{{row.DatasetID}}</td>
</ng-container>

我想通过这样的:

<ng-container matColumnDef="ID">
    <th mat-header-cell *matHeaderCellDef mat-sort-header>ID</th>
    <td mat-cell *matCellDef="let row">{{row.'Dataset ID'}}</td>
</ng-container>

如何设置格式的映射如果返回正确/字段名称有空格或特殊字符,如“@”?

angular angular-material2 ng-container
1个回答
0
投票

方括号救援:

{{ row['Dataset ID'] }}
© www.soinside.com 2019 - 2024. All rights reserved.