简体   繁体   English

添加查询参数时,amp-list不会显示来自firebase rest api的数据

[英]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.

相关问题 未登录时WP REST API将不会显示数据 - WP REST API won't show data when not logged in 单击按钮时刷新 amp-list 内容 - Refresh amp-list content on button click 是否可以将 REST API“浅”功能与 Firebase 数据过滤查询参数一起使用? - Is it possible to use the REST API "shallow" feature with Firebase data filtering query parameters? Rest Api不显示关系数据 - Rest Api don't show relationship data 使用REST API从Firebase检索数据 - Retrieve data from Firebase using REST API 是否可以通过SOAPUI中的脚本编辑器更改REST API中的查询参数? - is it possible to change the query parameters in REST API from script editor in SOAPUI? Firebase Rest API | 从 REST API 流式传输 - Firebase Rest Api | Streaming from the REST API 我正在尝试通过 azure 数据工厂将数据从 REST API 下载到 azure 数据湖。 如何在 azure 数据工厂中传递 API 的查询参数? - I am trying to download data from REST API to azure data lake via azure data factory. How can I pass query parameters for API in azure data factory? 调用REST API使用URL和参数从网站检索数据 - Calling REST API to retrieve data from a website using URL and parameters 如何将 JSON 数据从 rest API 导入到 google firebase? - how to import JSON data from rest API to google firebase?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM