假设我有非常大的单元格网格,我想添加数据行和数据col属性值并从模型绑定。如何从angular2绑定数据行(Dart中的beta0)。
使用data-row =“{{boundVal}}绑定”似乎不起作用。 (输出html中没有数据属性)
例如
<table>
<tr *ngFor="#row of rows" >
<td *ngFor="#cell of row.cells" data-row="{{row.index}}" data-col="{{cell.index}}" >
</td>
</tr>
</table>
答案 0 :(得分:123)
这应该做你想要的事情
[attr.data-row]="row.index" [attr.data-col]="cell.index"