[英]amp-list won't show data from firebase rest api while query parameters are added
I am using amp-list with firebase REST api. 我正在使用带有firebase REST api的amp-list。 The thing is when I use " https://kitchentocustomer.firebaseio.com/restaurants/Yiecu6fL2Pas0XFhCsT06Q0dSOp1/menu.json " I get the amp-list populated,but when I add query parameters " https://kitchentocustomer.firebaseio.com/restaurants/Yiecu6fL2Pas0XFhCsT06Q0dSOp1/menu.json?orderBy=%22first_cat%22&equalTo=%22BREAKFAST%22&print=pretty " I get empty amp-list. 问题是当我使用“ https://kitchentocustomer.firebaseio.com/restaurants/Yiecu6fL2Pas0XFhCsT06Q0dSOp1/menu.json ”时,我得到了放大器列表,但是当我添加查询参数时“ https://kitchentocustomer.firebaseio.com/ restaurant / Yiecu6fL2Pas0XFhCsT06Q0dSOp1 / menu.json?orderBy =%22first_cat%22&equalTo =%22BREAKFAST%22&print = pretty “我得到空的放大器列表。
Here is the code 这是代码
<amp-list width="300"
height="250"
single-item
items="."
layout="responsive"
src="https://kitchentocustomer.firebaseio.com/restaurants/Yiecu6fL2Pas0XFhCsT06Q0dSOp1/menu.json?orderBy=%22first_cat%22&equalTo=%22BREAKFAST%22&print=pretty">
<template type="amp-mustache">
<div>
<dt class="col col-10 h3 mb1">{{title}}</dt>
<dd class="col col-2 m0 mb1 self-center right-align">₹{{price}}</dd>
</div>
</template>
</amp-list>
The amp-list response must be a JSON object containing an array property. amp-list响应必须是包含数组属性的JSON对象。
Your filtered query (second link) returns a JSON object which does not contain an array. 您的筛选查询(第二个链接)返回一个不包含数组的JSON对象。
Your response for this should be something like below 您对此的回答应如下所示
[
{
"discounted": 157,
"first_cat": "BREAKFAST",
"id": "eEaVn8",
"onSale": false,
"price": 167,
"third_cat": "Egg",
"title": "Egg omlete"
},
{
"discounted": 210,
"first_cat": "BREAKFAST",
"id": "pia9nL",
"onSale": false,
"price": 228,
"third_cat": "Waffles",
"title": "Banana & Nutella waffles"
}
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.