分析器错误:表达式末尾属性访问的预期标识符 [{{ coin."24H" }}]



嘿,我正试图用ng解析从数组到html的一些数据,但在我最后一次映射时,键被称为"24h体积";

<tbody *ngFor="let coin of cryptoCoins; let i = index">
<tr>
<th>{{ i + 1 }}</th>
<td>
<img
height="32"
width="32"
src="{{ coin.iconUrl }}"
alt="{{ coin.name }}"
/>
</td>
<td>{{ coin.name }}</td>
<td>{{ coin.symbol }}</td>
<td>{{ coin.price }}</td>
<td>{{ coin.marketCap }}</td>
<td>{{ coin.24hVolume }}</td>
</tr>
</tbody>

如此棱角分明的人在抱怨:解析程序错误:在表达式〔{{coin.24H}}〕末尾需要属性访问的标识符

字符串插值似乎不理解我调用的是字符串值。我必须铸造钥匙吗?或者什么是最好的解决方案?

谢谢你的回答。

您是否尝试用括号访问它?,<td>{{ coin['24hVolume'] }}</td>

最新更新