Ich möchte die Felder Kategorie und SpecCategory zugreifen. Ich habe *ngFor="let x of data" {{x._id.category}}
angewendet, aber es funktioniert nicht. Was stimmt damit nicht?Objekt Zugriff über Angular
Ich verwende Aggregatfunktionalität, um die Kategorien zu gruppieren.
$group: {
_id: {
category: "$category",
specCategory: "$specCategory"
},
min: {$min: '$price'},
max: {$max: 500},
total:{$sum:1}
}
Ergebnis:
[ { _id: { category: 'Wasser & Wind', specCategory: 'Surfen' }, min: 49, max: 500, total: 1 }, { _id: { category: 'Reisen', specCategory: 'Hotel' }, min: 49, max: 500, total: 1 } ]
Ich brauche die Kategorie, specCategory und Gesamtwert für den Zugriff auf
Das liegt daran, dass das Objekt nicht ein Array ist. Angular2 unterstützt keine Iteration über Maps, nur über Arrays – devqon