gpt4 book ai didi

javascript - 我们如何以 Angular 打印字段属性数据

转载 作者:行者123 更新时间:2023-12-02 20:57:34 25 4
gpt4 key购买 nike

[
{
"model":"products.productstable",
"pk":1,
"fields":{
"company":"STANDARD",
"description":"CHAKKARS BIG ",
"type":"Chakkars",
"productcase":1,
"quantity":100,
"units":"PKT",
"rate":150.0,
"retension":3.0,
"newrate":154.5,
"myretension":30.0,
"finalrate":200.85,
"retailrate":401.7,
"remarks":"ABC"
}
},
{
"model":"products.productstable",
"pk":2,
"fields":{
"company":"STANDARD",
"description":"SMALL",
"type":"Sparkler",
"productcase":1,
"quantity":100,
"units":"PKY",
"rate":100.0,
"retension":3.0,
"newrate":103.0,
"myretension":25.0,
"finalrate":128.75,
"retailrate":257.5,
"remarks":"SCDC"
}
}
]

最佳答案

如果想在模板中显示,可以使用*ngFor as

<div *ngFor="let item of name">
<h2>Company: {{item.fields?.company}}</h2>
<p>Description: {{item.fields?.description}}</p>
<p>Type: {{item.fields?.type}}</p>
<p>Rate: {{item.fields?.rate}}</p>
</div>

演示 https://stackblitz.com/edit/angular-ejf6dw

关于javascript - 我们如何以 Angular 打印字段属性数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61435210/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com