Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How binding a JSON in Polymer 1.0 #1878

Closed
ypicoleal opened this issue Jun 15, 2015 · 2 comments
Closed

How binding a JSON in Polymer 1.0 #1878

ypicoleal opened this issue Jun 15, 2015 · 2 comments

Comments

@ypicoleal
Copy link

I have a Json like this:

[{
  "id":4,
  "fecha":"2015-05-13 22:34:01.560404+00",
  "latitude":"10.41413",
  "longitude":"-75.530156",
  "imagenes":[
      "media/6_img_0001.jpg",
      "media/7_img_0004.jpg"
  ]
},
{
  "id":5,
  "fecha":"2015-05-20 15:28:12.079346+00",
  "latitude":"10.402313",
  "longitude":"-75.505112",
  "imagenes":[
      "media/8_ctev.jpg",
      "media/9_2560x1600.jpg"
  ]
}]

I'm trying to bind the JSON in a template repeat, like this one:


<dom-module id="bas-app">
<style></style>
<template>
<iron-ajax auto url="reportes.json" handle-as="json" on-response="handleResponse"></iron-ajax>
<paper-menu>
   <template is="dom-repeat" items="{{reportes}}">
      <paper-item>{{item.id}}</paper-item>    
   </template>  
</paper-menu>
</template>
</dom-module>
<script>
        Polymer({
            is: 'bas-app',
            reportes: [],
            handleResponse: function(event){
                this.reportes = event.detail.response;
            }
        });
</script>

but I got an error like this

Polymer::Attributes: couldn`t decode Array as JSON
@thanhnhan2tn
Copy link

Hello,
I have same issues, please give me a solution for this.
Thanks.

@zoechi
Copy link

zoechi commented Sep 15, 2015

StackOverflow might be a better place to ask questions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants