【发布时间】:2021-09-04 23:11:53
【问题描述】:
我想获取存储在 template_A 中的数据,即 col_1 和 col_2 并以表格格式打印,但我得到的是 [object,object]。我不知道如何获取存储为对象数组的数据。
我想在 template_A 旁边打印。您可以在控制台中查看数组。
{
"_id": {
"$oid": "611f354944c4571778df456c"
},
"assignmentId": "61235a452a8a2428a43514ed",
"studentId": "60dafc5c0254f7122e9fe7f0",
"assignmentOf": "subject",
"createdAt": {
"$date": "2021-08-20T04:53:29.717Z"
},
"updateAt": {
"$date": "2021-08-20T04:53:29.717Z"
},
"__v": 0,
"grade": "b ",
"remark": "good",
"template": "template_A",
"template_A": {
"col_1": "col_1",
"col_2": "col_2"
},
"template_B": {
"col_1": "col_1",
"col_2": "col_2"
}
}
角度应用
<table>
<tr >
<td>{{ singleAssignment.template }}</td>
<td>{{ singleAssignment.template_A[0] }}</td>
<!-- <td>{{ singleAssignment.template_A[0] }}</td> -->
</tr>
</table>
【问题讨论】:
标签: node.js angular mongodb express