我有一个仪表板,我可以创建列表并将它们打印在短划线上,但是当我点击其中任何一个时,它只会打开最后创建一个。我究竟做错了什么?我正在使用最新的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 '
您可以编辑帖子以便阅读吗? –