我在用angular开发table元素.通过我的代码,一切正常.但当我需要在td
属性colspan
上实现属性绑定时,它会在浏览器控制台中显示以下错误:
Uncaught Error: Template parse errors:
Can't bind to 'colspan' since it isn't a known property of 'td'. ("Total Rows:
</td>
<td [ERROR ->]colspan="{{count}}">
{{rows}}
</td>
What I've tried is:
<table class="table table-hover" width="100%">
<tr>
<th *ngFor="let col of columns">
{{col}}
</th>
</tr>
<tr *ngFor="let data of getFilteredData">
<td *ngFor="let col of columns">
{{data[col]}}
</td>
</tr>
<tr>
<td colspan="{{count}}">
Total Rows: {{rows}}
</td>
</tr>
</table>
What I want:个
在我的.ts文件中,我为列数组的长度赋予了count
个值,所以无论列的长度是多少,我的脚注单元格都使用属性绑定进行均匀分布.
我也试着:
- [colspan]="计数"
- colspan="‘计数’"
但所有这些都不起作用,并且显示出同样的错误.