1
是我的JSONNG-中繼器不工作的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>
錯誤: 它已經填充了大量的空單項目。
幫助!
你能否告訴我們您的控制器代碼? (特別是你把json放入數組中的事實) 爲什麼你在ng-repeat中使用「track by $ index」? – Aliz 2014-10-09 08:17:45
我收到錯誤,說重複數據不允許。所以索引它。我從mongolabs中獲取json,將它存儲在localStorage中,然後將其設置在$ scope.facts中 – Kanishka 2014-10-09 14:20:44