1

I am new to polymer & trying to create a configurable template for the received iron-ajax response, means the end user who is using the component can decide the items which need to be displayed in the screen, so I used content tag inside the template but the data is not getting bind with my custom element.

 index.html
<custom-element>
    <div class="selected_content">
        <h2>{{item.id}}</h2>
        <span>{{item.member.dept.name}}</span>
    </div>
</custom-element>   

customElement.html    
<iron-ajax
    auto
    url={{url}}
    handle-as="json"
    last-response={{lastresponse}}
    debounce-duration="300"></iron-ajax>

<template is="dom-repeat" items=[[lastresponse]]>
    <content select=".selected_content"></content>
</template>
Supriya
  • 11
  • 3
  • What is the expected output ? what is the ajax-response content ? – SG_ Mar 17 '16 at 03:33
  • Thanks for your response. The Ajax response is JSON & the elements inside the content tag should fetch the JSON data & display it. Ex:

    15689

    production dept
    – Supriya Mar 17 '16 at 04:37
  • You may have to use javascript([`getDistributedNodes`](https://www.polymer-project.org/1.0/docs/devguide/local-dom.html#distributed-children)) for binding data to `content`, I dont think that polymer currently support `dom-repeat` binding to `content`, [this](http://stackoverflow.com/questions/34645114/polymer-dom-repeat-binding-to-content) may be helpfull – SG_ Mar 17 '16 at 05:23
  • If you don't want the end-user to be able to customize it, then use a `dom-repeat` and pass the `item` as user-defined property of `custom-element`. – SG_ Mar 17 '16 at 05:29

0 Answers0