Iron-list 未显示 AJAX 个结果
Iron-list doesn't show AJAX results
我在纸质对话框中有一个铁列表,我想用 AJAX 请求中的数据填充。
服务器的响应如下所示:
[{"name":"Bob"},{"name":"Tim"},{"name":"Mike"}]
这是我的自定义聚合物组件:
<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>
为什么列表是空的?
lastResponse
必须重命名为 last-response
.
我在纸质对话框中有一个铁列表,我想用 AJAX 请求中的数据填充。 服务器的响应如下所示:
[{"name":"Bob"},{"name":"Tim"},{"name":"Mike"}]
这是我的自定义聚合物组件:
<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>
为什么列表是空的?
lastResponse
必须重命名为 last-response
.