Я хочу удалить данные из базы данных.Я уже нашел ключ ребенка с
firebase.database().ref('Applications/' +
this.IDofLibrary).orderByChild('IDofUser').equalTo(input.IDofUser)
.once('value').then(snapshot => {
snapshot.forEach(function(child) {
console.log(child.key)
this.keyy = child.key // This line gave error ------
});
});
. Как я уже сказал, я уже видел ключ ребенка в консоли Google Chrome, как на рисунке ниже (рисунок 1)
![Picture 1](https://i.stack.imgur.com/0d4jW.png)
-LXQwVU8EFarKEsdNQtq - это ключ моего ребенка.
Но когда я пытаюсь сохранить его в переменную, я получаю сообщение об ошибке, подобное изображению, где top (рисунок 1).
Все коды указаны ниже.Как я могу удалить этого ребенка?
AcceptOrNot(input){
this.once = true;
const alert = this.alertCtrl.create({
title: input.nameOfUser +' ' + input.lastnameOfUser + 'onaylansın mı?' ,
buttons: [
{
text: 'Onayla',
handler: data => {
this.database.list('Applications/' + this.IDofLibrary + '/').valueChanges().subscribe((data2) => {
for(let item2 of data2){
if(this.once == true){
console.log("Once bilgisi : " + this.once)
console.log(item2.IDofUser + " ----" + input.IDofUser)
if(item2.IDofUser == input.IDofUser){
firebase.database().ref('Applications/' + this.IDofLibrary).orderByChild('IDofUser').equalTo(input.IDofUser)
.once('value').then(snapshot => {
snapshot.forEach(function(child) {
if(child.exists){
console.log(child.key);
this.keyy = child.key.toString;
}
});
});
this.database.list('Applications/' + this.IDofLibrary + '/').push({
Email : item2.Email,
IDofUser : item2.IDofUser ,
nameOfUser : item2.nameOfUser,
lastnameOfUser : item2.lastnameOfUser,
whichLibrary : item2.whichLibrary,
dateOfBorn : item2.dateOfBorn,
canBeRezerve : 'true',
});
this.once = false;
}
item2 = {};
}
}
})
}
},
{
text: 'Reddet',
handler: data => {
console.log('Saved clicked');
}
}
]
});
alert.present();
}
Редактировать: ![Informations of child](https://i.stack.imgur.com/HAQ1P.png)
Заранее спасибо!