我有一個數組:如何在<thead/>中迭代時選擇模板?
let headers = [
{ title: 'First Name', style: 'bold' },
{ title: 'Last Name', style: 'bold' },
{ title: 'Book', style: 'bold', titleSecond: 'All/Remainder', style2:'not bold' },
{ title: 'City', style: 'not bold', titleSecond: 'Street', style2: 'not bold' }
];
,我通過簡單的HTML表格迭代:
<table>
<thead>
<tr>
<th *ngFor="let header headers">
{{ header.title }}
</th>
</tr>
</thead>
</table>
是否有可能使表頭看起來像這樣:
是否可以爲表頭創建一些模板?我可以改變我的對象,因爲我想改變這個headers
對象。
它有什麼問題?爲什麼你的第四個對象有重複的屬性'style'? – yurzui
@yurzui哎呀,對不起,我編輯了一個對象。 – StepUp