JSON:
{
"Col1": "John",
"Col2": "Doe",
"Col3Combined": [
{
"Col3": "12",
"Col4Combined": [
{
"Col4": "156-345"
}
],
"Col5Combined": [
{
"Col5": "792-098"
}
]
}
]
},
{
"Col1": "Mike",
"Col2": "Keller",
"Col3Combined": [
{
"Col3": "12",
"Col4Combined": [
{
"Col4": "145-394"
}
],
"Col5Combined": [
{
"Col5": "156-323"
}
]
},
{
"Col3": "15",
"Col4Combined": [
{
"Col4": "909-203"
}
],
"Col5Combined": [
{
"Col5": "121-444",
"Col5": "134-232"
}
]
}
]
}
C#类:
public class Col4Combined
{
public string Col4 { get; set; }
}
public class Col5Combined
{
public string Col5 { get; set; }
}
public class Col3Combined
{
public string Col3 { get; set; }
public List<Col4Combined> Col4Combined { get; set; }
public List<Col5Combined> Col5Combined { get; set; }
}
public class RootObject
{
public string Col1 { get; set; }
public string Col2 { get; set; }
public List<Col3Combined> Col3Combined { get; set; }
}
我正在做以下事情:
List<RootObject> lr = new List<RootObject>();
lr.Add(new RootObject
{
Col1 = "test",
Col2 = "test2",
Col3Combined = new List<Col3Combined>(); //but then how do I populate it?
}
);
如何在上面的列表中填充Col3Combined
。
答案 0 :(得分:4)
您可以使用集合初始值设定项:
column.scope().settings
基本上你可以一直这样做:
angular.element('#' + column.id).scope()