Search code examples
dartdart-polymer

Conditional template for a row in a table shows warning in editor


The following table structure does not work:

<table>
  <tr><td>..</td></tr>
  <tr template if="{{flag==true}}">
<td>optional row</td>
 </tr>

If template is moved above a row as follows then code works.

<table>
  <tr><td>..</td></tr>
  <template if="{{flag==true}}">
    <tr >
  <td>optional row</td>
    </tr>
  </template>
</table>

but using template as above shows warning in editor: Unexpected start tag (template) in table context caused voodoo mode.

Currently I am ignoring the warning as code seems to work, but is it the right way to use template to conditionally display a row of a table?

thanks.


Solution

    • Your second version is the right/preferred/intended (not sure) way to do it.
    • Your first version is for browsers that don't support the <template> tag. This is the more compatible version.

    Polymer - FAQ - How do I use data-binding to repeat an or ?