我想從我的數組中拉取所有項目,稱爲「集合」。當我在html中輸入呼叫時,只能看到頁面數組中第一項的完整代碼。我試圖只拉入'edm.preview'這是該項目的圖像。我正在使用Angular Firebase和一個名爲Europeana的API。我的應用程序允許用戶搜索並選擇他們喜歡的圖像並將其保存到該特定用戶。ng-repeat似乎沒有工作
這裏是JS:
$scope.users = fbutil.syncArray('users');
$scope.users.currentUser.collections = fbutil.syncArray('collections');
$scope.addSomething = function (something) {
var ref = fbutil.ref('users');
ref.child($rootScope.currentUser.uid).child('collections').push(something);
}
$scope.addSomething = function(item) {
if(newColItem) {
// push a message to the end of the array
$scope.collections.$add(newColItem)
// display any errors
.catch(alert);
}
};
和HTML:
<ul id="collections" ng-repeat="item in collections">
<li ng-repeat="item in collections">{{item.edmPreview}}</li>
</ul>
爲什麼double ng-repeat? – Shomz 2014-10-06 14:23:58
嗨,恐怕我不是AngularJS專家,但我支持Europeana開發人員社區,並且看到您正在使用我們的API。我很想聽聽你在建什麼。如果您有任何問題,請給我留言[email protected] – jamesinealing 2014-10-09 12:30:15