Data binding for a dynamically created item
You can watch
- Creating a list of data programmatically
- Dart: Dynamically using policy-ui-tabs and polymer-ui-pages doesn't work
there was a similar question in Polymer.js with a simpler solution ( Data binding for dynamically generated HTML in Polymer? ), but I haven't seen anything similar for Polymer.dart yet.
I'll try to find something tomorrow, it's already quite late ...
I created this issue http://dartbug.com/21029
It has now been fixed with injectBoundHtml
. See https://groups.google.com/a/dartlang.org/d/msg/web/uqri0fpGH10/dPm169WUiUwJ for details .
source to share
I am using this workaround (polymer 0.15.5 + 4):
var template = new TemplateElement()
..setInnerHtml("<p>Reversed: {{ reversed }}</p>");
var fragment = this.instanceTemplate(template);
this.shadowRoot.append(fragment);
But it seems rather complicated to me and I haven't found a more elegant solution yet.
I'm confused by Gunther's phrase "The expressions used must already be used somewhere, so Smoke knows how to generate code for them." from Dart: dynamic use of polymer ui-tabs and polymer-ui pages doesn't work . Could anyone on this thread spark this point?
source to share