在角的* ngFor中迭代时固定单词中的破折号

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

我必须在* ngFor中迭代非乘积,但它不接受-它只能接受_,但在-

您将如何解决此问题?

*ngFor="let product of products?.non-product
angular angular6 ngfor angular-template
1个回答
0
投票

由于密钥属性名称不是有效的bracket notation,因此使用identifier

*ngFor="let product of products['non-product']"
© www.soinside.com 2019 - 2024. All rights reserved.