When I click the button, I want you to add +1 to the count, as if it were a reputation, every +1 click on the Firebase field, but when I click it it appears [object] [object] 1
This is my code:
constructor(public navCtrl: NavController, public navParams: NavParams, public alertCtrl: AlertController, public db: AngularFirestore) {
this.id = navParams.get("id")
this.pessoa = db.collection<any>("usuarios", ref => ref.where("id", "==", this.id)).valueChanges();
this.contadorPositivo = db.collection<any>("usuarios", ref => ref.where("contadorPositivo", "==", this.id)).valueChanges();
this.contadorNegativo = db.collection<any>("usuarios").valueChanges();
console.log(this.contadorNegativo.value);
}
votoNegativo() {
console.log(this.contadorNegativo);
this.db.collection('usuarios/').doc(this.id).update({contadorNegativo: + 1});
const alert = this.alertCtrl.create({
title: '',
subTitle: 'Obrigado pela classificação!',
buttons: [
{
text: 'OK',
handler: data => {
this.navCtrl.pop();
}
}
]
});
alert.present();
}
votoPositivo() {
this.db.collection('usuarios').doc(this.id).update({contadorNegativo: + 1});
const alert = this.alertCtrl.create({
title: '',
subTitle: 'Obrigado pela classificação!',
buttons: [
{
text: 'OK',
handler: data => {
this.navCtrl.pop();
}
}
]
});
alert.present();
}
}