[英]Display ng-grid with nested array of JSON objects?
I have some JSON data that looks like so: 我有一些看起来像这样的JSON数据:
return {
"activityTypes" :[{
"id" :"",
"name:" :"",
"icon" : "",
"partial": "",
"label" : {
"id": "",
"name": ""
}
}],
"apiKey" : "",
"approveBy": 0,
"approvers" : [],
"canSendTo" : [{
"id" : "",
"name" : ""
}],
"creators" : [],
"isActive" : false,
"notification" : false,
"sourceId": "",
"sourceName":""
};
I am trying to use ng-grid, but I am trouble trying to access the elements inside an array of objects, such as the activityTypes
or canSendTo
arrays. 我正在尝试使用ng-grid,但是在尝试访问对象数组(例如
activityTypes
或canSendTo
数组)内的元素时遇到了麻烦。 In the following example, I tried to display canSendTo's id. 在下面的示例中,我尝试显示canSendTo的ID。 I've tried the following but it does not render on the screen.
我尝试了以下方法,但它无法在屏幕上呈现。 Any ideas on how to fix this?
有想法该怎么解决这个吗? Thanks!
谢谢!
{field: 'canSendTo.id', displayName: 'Can Send To', width:'10%',
cellTemplate: '<div class="ngCellText", style="white-space: normal;">{{row.getProperty(col.field)}}</div>'},
我对ng-grid一无所知,但是从直接的javascript角度来看,它应该是canSendTo [0] .id,因为canSendTo是一个单元素数组。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.