如何绑定到angular2中的data- *属性?
发布时间:2020-12-17 09:27:48 所属栏目:安全 来源:网络整理
导读:参见英文答案 Angular 2 data attributes1 假设我有很大的单元格网格,我想添加数据行和数据库的属性值并从模型绑定.我如何绑定数据行从angular2(在Dart的beta0). 与data-row =“{{boundVal}}”的绑定似乎不起作用. (没有数据属性出现在输出html中) 例如. tab
参见英文答案 >
Angular 2 data attributes1
假设我有很大的单元格网格,我想添加数据行和数据库的属性值并从模型绑定.我如何绑定数据行从angular2(在Dart的beta0). 与data-row =“{{boundVal}}”的绑定似乎不起作用. 例如. <table> <tr *ngFor="#row of rows" > <td *ngFor="#cell of row.cells" data-row="{{row.index}}" data-col="{{cell.index}}" > </td> </tr> </table>
这应该做你想要的
[attr.data-row]="row.index" [attr.data-col]="cell.index" (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |