本文介绍了创建于JS角矩阵表意见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是我的JSON对象(部分),我想显示为矩阵表preferably采用NG-重复:
Below is my JSON object(partial) which I would like to show as a matrix table preferably using 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的。
I have tried http://plnkr.co/edit/iW1dZV?p=info but I don't want to use coffeescript.
推荐答案
@forgottofly这里是你需要什么更好的JSON的例子:
@forgottofly here is an example of better json for what you need:
[{
"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
}]
}]
这篇关于创建于JS角矩阵表意见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!