我从不同的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>
如何设置格式的映射如果返回正确/字段名称有空格或特殊字符,如“@”?
方括号救援:
{{ row['Dataset ID'] }}