以下是我的JSON对象(部分),我希望将其显示为矩阵表,最好使用ng-repeat:
[
{
"product": "milk",
"resource": "a",
"checked": true
},
{
"product": "bread",
"resource": "a",
"checked": false
},
{
"product": "butter",
"resource": "a",
"checked": true
}
]
我尝试了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/