【问题标题】:Iron-list doesn't show AJAX resultsIron-list 不显示 AJAX 结果
【发布时间】:2015-11-09 21:57:31
【问题描述】:

我在纸质对话框中有一个铁名单,我想用来自 AJAX 请求的数据填充。 来自服务器的响应如下所示:

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

这是我的自定义 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>

为什么列表为空?

【问题讨论】:

    标签: javascript polymer web-component


    【解决方案1】:

    lastResponse 必须重命名为 last-response

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-10
      • 2012-08-05
      • 1970-01-01
      • 2012-12-18
      • 2018-07-08
      相关资源
      最近更新 更多