【发布时间】:2017-06-06 20:45:41
【问题描述】:
对不起,我的问题。也许这太明显了,但我是 Ionic 的新手,我希望尽可能做到最好。
我有一个条形码扫描仪,它返回一个带有我的 firebase 数据库中集合键的值。我需要知道扫描的代码是否存在于我的数据库中。到目前为止,这就是我所拥有的:
export class HomePage {
constructor(
private barcode: BarcodeScanner,
public navCtrl: NavController,
af: AngularFireDatabase) {
// Here I get the list of elements where I will search the scanned code.
this.ocupadas = af.list('/UbicacionesOcupadas', {
query: {
orderByChild: 'evento',
equalTo: 28
}
});
}
// Here I get the QR Code value.
async scanBarcode() {
this.results = await this.barcode.scan(this.options);
}
// Now, I need to know if the QR Code value is in the firebase list. How would you do?
【问题讨论】:
-
checkout developer.mozilla.org/en/docs/Web/JavaScript/Reference/… 使用 find 比较
this.results和this.ocupadas
标签: angular firebase firebase-realtime-database ionic2