我有一個儀表板,我可以創建列表並將它們打印在短劃線上,但是當我點擊其中任何一個時,它只會打開最後創建一個。我究竟做錯了什麼?我正在使用最新的Angular,Firebase和AngularFire。點擊舊列表只顯示上次創建的ID,應該顯示列表ID點擊
我的代碼看起來像這樣,以創造和開放的功能:
allLists = new Firebase('https://url.firebaseio.com/lists/' + authData.uid);
// Modal service for creating a new list
$scope.createList = function(){
newList = allLists.push({
name: 'new list'
});
listUID = newList.key();
$rootScope.listUID = new Firebase('https://url.firebaseio.com/lists/' + authData.uid + '/' + listUID);
// Runs the ngDialog scheme with template etc
ngDialog.open({
template:'user-modal.html',
controller: 'createController',
scope: $scope,
className:'ngdialog-theme-default'
});
console.log('listUID is: ' + listUID);
return listUID;
};
// Modal service for opening an old list for edit/remove/whatnot
$scope.openList = function(index){
oldUID = new Firebase('https://url.firebaseio.com/lists/' + authData.uid + '/' + listUID);
ngDialog.open({
template: 'user-old-list.html',
controller: 'oldListController',
className: 'ngdialog-theme-default',
scope: $scope
});
console.log(listUID);
};
通過簡單的HTML作爲本:
<div ng-repeat="(id, lists) in listCounter" class="user-lists">
<button ng-click="openList()" ng-model="listCounter[id]">{{lists.$id}}<br />{{lists.name}}</button>
</div>
其中提到:
$rootScope.listCounter = $firebaseArray(allLists);
我們可以看到完整的'ng-repeat'代碼嗎? –
@MuliYulzary '
您可以編輯帖子以便閱讀嗎? –