我正在使用 Kendo UI 开发 Angular 8 应用程序。
所以,我有这个带有自定义模板的下拉列表:
<kendo-dropdownlist name="theme"
[data]="themeItems"
[textField]="'text'"
[valueField]="'id'"
[(ngModel)]="theme"
(valueChange)="onChangeTheme($event)"
style="width: 100%">
<ng-template kendoDropDownListValueTemplate let-dataItem>
<span *ngIf="dataItem != null">
<i class="fa fa-circle text-{{dataItem?.id}} pr-1"></i>{{ dataItem?.text }}
</span>
</ng-template>
<ng-template kendoDropDownListItemTemplate let-dataItem>
<span data-toggle="theme" [data-theme]="dataItem.url">
<i class="fa fa-circle text-{{dataItem.id}} pr-1"></i>{{ dataItem.text }}
</span>
</ng-template>
</kendo-dropdownlist>
并且themeItems
:
themeItems = [
{
id: 'default',
text: 'Default',
url: 'default'
}, {
id: 'amethyst',
text: 'Amethyst',
url: 'assets/css/themes/amethyst.min.css'
}, {
id: 'city',
text: 'City',
url: 'assets/css/themes/city.min.css'
}
];
我看到错误Can't bind to 'data-theme' since it isn't a known property of 'span'
我该如何解决?