gpt4 book ai didi

javascript - 关于在 Angular JS 中创建矩阵表的建议

转载 作者:行者123 更新时间:2023-11-29 16:09:32 27 4
gpt4 key购买 nike

下面是我的 JSON 对象(部分),我想将其显示为矩阵表,最好使用 ng-repeat:

[
{
"product": "milk",
"resource": "a",
"checked": true
},
{
"product": "bread",
"resource": "a",
"checked": false
},
{
"product": "butter",
"resource": "a",
"checked": true
}
]

enter image description here

我试过了http://plnkr.co/edit/iW1dZV?p=info但我不想使用 coffeescript。

最佳答案

@forgottofly 这是一个更好的 json 示例,可以满足您的需要:

[{
"resource": "a",
products: [{
"product": "milk",
"checked": true
}, {
"product": "bread",
"checked": false
}, {
"product": "butter",
"checked": true
}]
}, {
"resource": "b",
products: [{
"product": "milk",
"checked": false
}, {
"product": "bread",
"checked": true
}, {
"product": "butter",
"checked": true
}]
}, {
"resource": "c",
products: [{
"product": "milk",
"checked": false
}, {
"product": "bread",
"checked": true
}, {
"product": "butter",
"checked": true
}]
}]

关于javascript - 关于在 Angular JS 中创建矩阵表的建议,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32500354/

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