Я читаю идентификатор тега nf c и сохраняю его в базе данных в виде шестнадцатеричной строки. Это работает без проблем, но я хочу иметь возможность добавить продукт, содержащий соответствующий tagid, в мою корзину и не знаю, как go об этом.
Этот код позволяет читать тегид и сохранять в база огня:
readNFC() {
this.nfc.addNdefListener(() => {
this.presentAlert('ok');
}, (err) => {
this.presentAlert('ko' + err);
}).subscribe((event) => {
console.log(event);
console.log(JSON.stringify(event));
//this.presentAlert(this.nfc.bytesToHexString(event.tag.id));
this.productForm.patchValue({ tagid: this.nfc.bytesToHexString(event.tag.id)});
});
} ```
This is the code I'm using to then try get the product that contains the tagid that is read from the nfc tag but I'm having no success with it
``` private onNdefEvent(event) {
this.listenAlert.dismiss();
this.cartService.addProduct(this.product ==
this.db.collection('products', ref => ref.where('tagid', '==', this.nfc.bytesToHexString(event.tag.id))));
}```
[image of firebase][1]
[1]: https://i.stack.imgur.com/NuRHt.png