多select错误this.value未定义
Multi-select error this.value is undefined
我正在尝试在 Kendo UI 中为 Angular 2 使用新的 multi-select 组件,但是 "this.value is undefined" 在 Firebug 当小部件启动时。
<kendo-multiselect name="watchbill" [data]="watchbills" [(ngModel)]="selectedWatchbills" [textField]="'name'" [valueField]="'id'"></kendo-multiselect>
selectedWatchbills: Watchbill[];
watchbills: Watchbill[];
ngOnInit() {
this.shipDataService.getWatchbills(this.startTime, this.endTime).subscribe(
data => this.watchbills = data
);
}
export interface Watchbill {
id: string,
name: string
}
这可能是视图在数据到达之前呈现的问题,因此请尝试像这样放置 ngIf
:
<kendo-multiselect *ngIf="watchbills" name="watchbill" [data]="watchbills"
[(ngModel)]="selectedWatchbills" [textField]="'name'" [valueField]="'id'"></kendo-multiselect>
等待数组 watchbills
中存在值,然后再呈现包含在该标记内的任何内容。
我正在尝试在 Kendo UI 中为 Angular 2 使用新的 multi-select 组件,但是 "this.value is undefined" 在 Firebug 当小部件启动时。
<kendo-multiselect name="watchbill" [data]="watchbills" [(ngModel)]="selectedWatchbills" [textField]="'name'" [valueField]="'id'"></kendo-multiselect>
selectedWatchbills: Watchbill[];
watchbills: Watchbill[];
ngOnInit() {
this.shipDataService.getWatchbills(this.startTime, this.endTime).subscribe(
data => this.watchbills = data
);
}
export interface Watchbill {
id: string,
name: string
}
这可能是视图在数据到达之前呈现的问题,因此请尝试像这样放置 ngIf
:
<kendo-multiselect *ngIf="watchbills" name="watchbill" [data]="watchbills"
[(ngModel)]="selectedWatchbills" [textField]="'name'" [valueField]="'id'"></kendo-multiselect>
等待数组 watchbills
中存在值,然后再呈现包含在该标记内的任何内容。