这里是我的JSON
[{"_id":{"$oid":"54357d7f62042c439bfd6279"},"imageType":"Image/jpg","Heading":"Test Heading","Description":"Test Discription","Image":"","created_at":"","infoType":"QuickInfo"},{"_id":{"$oid":"54357eb862042c439bfd627a"},"imageType":"Image/png","Heading":"Test Heading 2","Description":"Test Discription 2","Image":"","created_at":"","infoType":"QuickInfo"}]
我的中继器
<ion-list>
<ion-item ng-repeat="fact in facts track by $index" href="#/app/fact/{{fact._id}}">
{{fact.Heading}}
</ion-item>
</ion-list>
错误:它已经填充了大量的空单项目。
救命!!
这似乎是工作确定。
$scope.facts=[
{
"_id":{"$oid":"54357d7f62042c439bfd6279"},
"imageType":"Image/jpg",
"Heading":"Test Heading",
"Description":"Test Discription",
"Image":"",
"created_at":"",
"infoType":"QuickInfo"
},
{
"_id":{"$oid":"54357eb862042c439bfd627a"},
"imageType":"Image/png",
"Heading":"Test Heading 2",
"Description":"Test Discription 2",
"Image":"","created_at":"","infoType":"QuickInfo"
}
];
<ion-list>
<ion-item ng-repeat="fact in facts track by $index" href="#/app/fact/{{fact._id}}">
{{fact.Heading}}
</ion-item>
</ion-list>
编辑:另外,如果你找回数据作为JSON,你可以做
$scope.facts=JSON.parse(json_string);