Is it possible to render a List<Element> in Polymer.dart?

Issue

Given a List<Element> elements, is it possible to render the elements in the template, like this?

<template repeat="{{element in elements}}">
    {{element.SOMETHING}}
</template>

I’d want it to observe the list too, so that it would add and remove elements as the list changes.

Solution

Update

A ready-to-use element for Dart Polymer 1.0 is bwu-bind-html


{{}} can’t include HTML.

You can use something like the <safe-html> tag (see answer to HTML Tags Within Internationalized Strings In Polymer.dart)

<template repeat="{{element in elements}}">
    <safe-html model="{{element.SOMETHING}}"></safe-html>
</template>

but I guess you have to change the <self-html> implementation so that it replaces itself with the content of model instead of adding model to it’s content, because ul/ol can’t contain <self-html>

Answered By – Günter Zöchbauer

Answer Checked By – Gilberto Lyons (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.