Я изучаю Polymer 1.8 и пытаюсь получить данные из API.после этого я хочу связать данные из моей функции ontap () с помощью dom-repeat, но я получаю странную ошибку в консоли: [dom-repeat :: dom-repeat]: ожидаемый массив для items
, найден[{ "requestnum": "тысяча сорок-пять", "orgid": "EAGLENA"}, { "requestnum": "+1046", "orgid": "EAGLENA"}, { "requestnum": "1 047", "orgid":"EAGLENA"}, {"requestnum": "1048", "orgid": "EAGLENA"}, {"requestnum": "1049", "orgid": "EAGLENA"}]
я могу 'не может решить эту проблему кто-нибудь может мне помочь?Что не так в этом коде ????
я использую полимер 1.8
* это мой HTML-файл maximo-test-card.html:
<dom-module id="maximo-test-card">
<template>
<template is="dom-repeat" items="{{hi}}">
<li>
<span>{{item.requestnum}}</span>
</li>
</template>
<div>{{hi}}</div>
<iron-ajax
id="requestRepos"
headers='{"Content-Type": "application/json", "Accept": "someAccept", "Authorization": "someAuthorizationToken"}'
url="http://vaganet.vaganet.fr:9080/maximo/oslc/os/mxinvres?oslc.select=*"
handle-as="json"
on-response="ontap"> </iron-ajax> </template>
<script src="maximo-test-card.js"></script>
</dom-module>
*this is my js file maximo-test-card.js:
Polymer({
is: 'maximo-test-card',
properties: {
repos: {
type: Array
},
githubrepository:{
type: Array
},
hi:{
type: Array,
},
},
ready: function () {
this.$.requestRepos.generateRequest();
//console.log(hi)
//this.name=hi
},
ontap: function (data) {
this.repos = data.detail.response.member;
hi = []
for (var i = 0; i < 5; i++) {
hi[i] = {"requestnum":this.repos[i].requestnum,"orgid":this.repos[i].orgid}
}
this.hi = JSON.stringify(hi)
alert(this.hi);
return this.hi;
},
});