【发布时间】:2020-09-11 01:06:03
【问题描述】:
我正在使用 Firebase 开发 NativeScript 应用程序。 我必须根据它们在 firebase 数组对象中的状态来显示特色元素。状态是
featured= true.
我想使用查询参数直接在我的函数的 url 中进行过滤(即在 http 请求中不使用标头)。
这是 firebase 数据结构的示例
dishes
0
category:
"mains"
comments
description:
"A unique combination of Indian Uthappam (pancak..."
featured: "true"
id: 0
image: "https://www.inspiredtaste.net/wp-content/upload..."
label: "Hot"
name: "Uthappizza"
price: "4.99"
这是我的基于 typscript 角度的方法:
getFeaturedDish(): Observable<Dish> {
return this.http.get<Dish[]>(baseURL + 'dishes.json' /**query placeholder */).pipe(map(dishes => dishes[0]))
.pipe(catchError(this.processHTTPMsgService.handleError));
}
【问题讨论】:
标签: javascript json angular firebase-realtime-database