2015-11-09 109 views
0

我在一個紙對話框中有一個鐵列表我想填充來自AJAX請求的數據。 來自服務器的響應如下所示:鐵列表不顯示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> 

爲什麼名單住空?

回答

2

lastResponse必須重命名爲last-response

+1

在聚合物中發現錯誤是目前可怕的 – Hedge