I'm new to Polymer and I'm trying to loop over an API response using the iron-ajax element and I'm running into troubles. The error I'm getting is: polymer-micro.html:260 [dom-repeat::dom-repeat]: expected array for
items, found Object
This is what I'm using:
<dom-module id="untappd-data">
<template>
<style>
:host {
display: block;
box-sizing: border-box;
}
</style>
<iron-ajax
auto
url="https://api.untappd.com/v4/user/checkins/jimouk?client_id=[hidden]&client_secret=[hidden]"
handle-as="json"
last-response="{{response}}"></iron-ajax>
<template is="dom-repeat" items="{{response.response.checkins}}">
{{item.name}}
</template>
</template>
</dom-module>
<script>
Polymer({
is: 'untappd-data',
properties: {
owner: {
value: 'polymer',
notify: true
},
url: {
computer: 'computeUrl(owner)'
}
}
});
</script>
I understand that the dom-repeater element only loops over arrays but I'm wondering if there's a certain method I should be following with Polymer instead of moving all of those objects into an array with traditional Javascript.