我有以下问题:
此index.html创建一个表:
<table class="table-bordered">
<th>
<td ng-repeat="column in sheet.columns">{{column}}</td>
</th>
<tr ng-repeat="row in sheet.rows">
<td>{{row}}</td>
<td ng-repeat="column in sheet.columns">
<div>
<input style="border: none; text-align: center" ng-model="sheet.cells[column+row]" ng-change="sheet.change(sheet.cells[column+row], column, row)"/>
</div>
</td>
</tr>
</table>
SheetController使用dataService.data中的值填充表。
setup(){
this.data = this.dataService.data;
this.rows = [];
this.cells = {};
for(var i = 0; i < this.data.months[this.month].days.length; i++){
this.rows.push(i+1);
this.cells[this.columns[0] + this.rows[i]] = this.data.months[this.month].days[i].date;
}
}
现在我想更改某些单元格的背景颜色,例如:
this.cells[...].style.add("background-color", yellow);
我知道这是不可能的,因为它是ng-model值,而不是真实的领域,是否有解决方法?