使用查询参数从firebase中获取ProductById。

问题描述 投票:0回答:1

我正在尝试在点击NativeScript应用项目时动态地获取产品。我目前使用的是firebase,我对它不熟悉。

下面是我的方法

  getDish(id: number): Observable<Dish> {
    return this.http.get<Dish>(baseURL +'dishes.json/'+ id)
      .pipe(catchError(this.processHTTPMsgService.handleError));
  }

而这里是firebase目标"[firebaseName]firebaseio.comdishes0" [1234等]。

我做错了什么?

如果你有特别的纠正或链接,将非常感激。

javascript typescript firebase firebase-realtime-database nativescript
1个回答
0
投票

.json 后缀需要放在URL的最后。

return this.http.get<Dish>(baseURL +'dishes/'+ id + '.json')
© www.soinside.com 2019 - 2024. All rights reserved.