我的架构看起来像:
超级.js:
var superSchema = new Schema({
title: {
type: String,
default: '',
trim: true
},
item: [{
type: Schema.ObjectId,
ref: 'Item'
}]
});
item.js:
var itemSchema = new Schema({
name: {
type: String,
default: '',
trim: true
}
});
我的 json 然后看起来像这样:
[{
"title": "Team 1",
"items": [
"52c23f2129sdf1720d000006",
"52c23f2129asd1720d000006",
"52c23f212992cfdsd00000f6"]
},{
"title": "Team 2",
"items": [
"52c23f2129sdf1720d000006",
"52c23f2129asd1720d000006",
"52c23f212992cfdsd00000f6"]
}]
然后我尝试item[0].name
像这样访问我的 list.html 文件中的 ,{{item[0].name}}
但它没有返回任何内容,并且 item[0] 返回了 id。
如何访问我的 Angular html 文件中的 item[0].name?
我的superDuperController.js:
$scope.find = function() {
SuperDuper.query(function(superDuper) {
$scope.superDuper = superDuper;
});
};