我有以下代码永久陷入150条记录的循环中。我在这里做错了什么??
this.getData.getUsers().snapshotChanges().subscribe((usersRes) => {
let c: any = [];
c = usersRes.map(c => ({ key: c.key, ...c.payload.val() }));
if (c.length > 0) {
for (var i = 0; i < c.length; i++) {
if (c[i].uid != this.afAuth.auth.currentUser.uid) {
let friend = { $key: c[i].uid, ...c[i] };
console.log("Inside For: " + i);
this.addOrUpdateFriend(friend);
}
}
} else {
this.friends = [];
}
});