我有一个函数,它从 typescript 函数作为对象返回颜色、文本颜色和日期值。我想将其存储在 let 变量中。我可以直接使用该函数,但不想复制函数的调用。
这给了我错误,例如找不到“年份”
<kendo-grid-column-group title="{{year}}" [headerStyle]="{'text-align': 'center'}" width="380">
<ul *ngFor="let month of keys(); let i = index">
<li>
<kendo-grid-column field="{{month}}" class="no-padding" title="{{month}}" [filterable]="false" [sortable]="false" width="35">
<ng-template kendoGridCellTemplate let-dataItem let-color="getColor(year,i,dataItem.ca)">
<span class="whole-cell" [ngStyle]="{'background-color': color.color,'color': color.textColor,'font-weight':'bold','height':'25px','vertical-align': 'middle'}">
<label>{{color.Date}}</label>
</span>
</ng-template>
</kendo-grid-column>
</li>
</ul>
</kendo-grid-column-group>