简体   繁体   English

铁清单不显示AJAX结果

[英]Iron-list doesn't show AJAX results

I've got an iron-list inside a paper-dialog I would like to fill with data from an AJAX-request. 我在纸质对话中有一个铁清单,我想用来自AJAX请求的数据来填充。 The response from the server looks like this: 来自服务器的响应如下所示:

[{"name":"Bob"},{"name":"Tim"},{"name":"Mike"}]

This is my custom Polymer component: 这是我自定义的Polymer组件:

<link rel="import" href="../../bower_components/iron-list/iron-list.html">
<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
<link rel="import" href="../../bower_components/paper-dialog/paper-dialog.html">

<dom-module id="my-dialog">
  <template>
    <iron-ajax id="getAjax" url="/getdata" handle-as="json" lastResponse="{{data}}" auto></iron-ajax>
    <paper-dialog id="loadDialog">
      <h2>Header</h2>
        <iron-list items="[[data]]" as="item" style="height:200px">
          <template>
            <div>
              Name: <span>[[item.name]]</span>
            </div>
          </template>
        </iron-list>
    </paper-dialog>
  </template>

Why is the list staying empty? 为什么列表保持空白?

lastResponse必须重命名为last-response

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM