我有一个表组件,我提供了一些设置,比如列宽,但它们似乎最终没有在最终呈现的html中
表格模板:(不确定语法)
<div *ngIf="settings">
<table>
<thead>
<tr>
<th *ngFor="let column of settings.columns" [style.width]="column.width+'px'">
<span>{{ column.name }}</span>
</th>
...
表组件:
...
export class DataTableComponent {
@Input() settings: any;
...
父模板(使用表格):
<my-datatable [settings]="tableSettings" ></my-datatable>
父组件(在构造函数中)
this.tableSettings = {
columns: [
{ name: this.trads["ID"], value: 'id', width: "30px", insertable: false },
{ name: this.trads["FirstName"], value: 'firstname', width: "100px", insertable: true },
{ name: this.trads["LastName"], value: 'lastname', width: "100px", insertable: true },
{ name: this.trads["Email"], value: 'email', width: "100px", insertable: true },
]
};
这看起来是正确的,但我不能让它工作 任何想法?
感谢