如何在 HTML 上显示 angular 数组项

How to show angular array items on HTML

我想在 html 上显示 item1 的 ing1 的值

item2 有效,但 item1.ing1 确实有效

如何在 html 文件中显示 ing1 值。谢谢

您忘记select数组中的数字{{product.item1[0].ing1 }}

item1 是一个对象数组。要显示 ing1 值(考虑到它总是出现在第 0 个索引处),您可以这样写:

product.item1[0].ing1

我还假设你在 gems 上做 ng-repeat,它的每个项目是 product