2015-04-27 24 views
0

如何將div附加到每個tr如何將div添加到Polymerjs中的每個tr

以下示例不起作用。它附加一個divtable,而不是每個tr

<table> 
<tr repeat="{{ el in elements }}"> 
    <td>{{ el.name }}</td> 
    <div> This tag I want to append to tr tag </div> 
</tr> 
</table> 
+1

你的第二個'tr'不是一個結束標記,即''。這可能是問題嗎? – zunder

+1

我認爲這不是聚合物問題,因爲我知道'tr'只能有'td'或'th'直接後代;你有沒有檢查[這篇文章](http://stackoverflow.com/a/7051236/2407522)和[this](http://stackoverflow.com/a/2974609/2407522)。 –

回答

0

這會打印很多<td>,但我不知道你在找什麼。試試吧

<table> 
<tr> 
    <template repeat="{{ el in elements }}">  
     <td>{{ el.name }}</td> 
    </template> 

    <div> This tag I want to append to tr tag </div> 
</tr> 
</table> 
相關問題