当我的程序获得这样的JSON响应时:
[
{
"index": 1,
"name": "Samantha",
"rarity": "Scarborough",
"email": "maureen@sykes.mk"
},
{
"index": 2,
"name": "Amanda",
"rarity": "Vick",
"email": "jessica@livingston.mv"
}
]
AngularJS显示ng-repeat
欺骗错误。我也尝试过使用:$index
跟踪。
但如果我的JSON响应是这样的:
{"items":
[
{
"index": 1,
"name": "Samantha",
"rarity": "Scarborough",
"email": "maureen@sykes.mk"
},
{
"index": 2,
"name": "Amanda",
"rarity": "Vick",
"email": "jessica@livingston.mv"
}
]
}
我可以使用ng-repeat = "name in variable.items"
为什么AngularJS的行为如此?