这是我的 Angular 2 剑道下拉菜单:
<kendo-dropdownlist
[defaultItem]="defaultItem"
[data] = "getYears"
[textField]="'YearText'"
[valueField]="'YearValue'"
[(ngModel)] = "selectedYear"
>
</kendo-dropdownlist>
clearFilters()是我在 UI 上单击清除时执行的方法。
private selectedYear : Year = { YearText: "Select...", YearValue: null };
clearFilters(): void {
this.selectedYear = { YearText: "Select...", YearValue: null };
}
但是当我单击清除时,它不会自行选择?我究竟做错了什么?