【发布时间】:2017-05-28 22:05:30
【问题描述】:
我想访问字段类别和规范类别。我申请了*ngFor="let x of data" {{x._id.category}},但它不起作用。有什么问题?
我正在使用聚合功能对类别进行分组。
$group: {
_id: {
category: "$category",
specCategory: "$specCategory"
},
min: {$min: '$price'},
max: {$max: 500},
total:{$sum:1}
}
结果:
[ { _id: { category: 'Wasser & Wind', specCategory: 'Surfen' }, min: 49, max: 500, total: 1 }, { _id: { category: 'Reisen', specCategory: 'Hotel' }, min: 49, max: 500, total: 1 } ]
我需要访问类别、规格类别和总值
【问题讨论】:
-
那是因为你的对象不是数组。 Angular2 不支持遍历地图,只支持数组
标签: javascript angularjs typescript mongoose