In Polymer 1.0+, how do you pass in a template from the light DOM to be
used in the dom-module? I'd like the template in the light DOM to have bind
variables, then the custom element use that template to display its data.
This way, the application developer (component user, not the component
developer) does not have to know about Polymer, iron-list's, dom-bind's,
nor do they have to design a component.
Here is an example of how it would be used by the component user:
<weather-forecast days="5" as="day">
<template id="forecast-template">
<img src="{{day.weatherpic}}">
<div>{{day.dayofweek}}</div>
<div>{{day.wordy}}</div>
<div>{{day.highlowtemp}}</div>
</template>
</weather-forecast>
This weather-forecast component would contain an iron-list in the
dom-module and ideally, the component would reference the
"forecast-template" inside the iron-list that would bind the variables to
the element. Ultimately, it would generate a 5-day forecast using that
template. My issue is that I haven't seen an example of bind-passing
variable based templates into a Polymer 1.0 custom element. I would think
this or something similar would be fairly commonplace.
The following is an example of how I would like to see it work on the
client side, but no luck yet. Although the template is successfully
referenced via the <content> tag, it only displays once, while other fields
actually do show in the loop.
<dom-module id="weather-forecast">
<template is="dom-bind">
<iron-list items="[[days]]" as="day">
<content selector='#forecast-template'"></content>
</iron-list>
</template>
</dom-module>
Any input is appreciated. Thanks!
This is already cross posted at Stack Overflow here
<http://stackoverflow.com/questions/33225756/polymer-1-0-cant-define-template-in-light-dom-for-use-by-component>
.
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/polymer-dev/446eb3df-9d1c-40f2-8a23-1b8abfb6f38f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.