我尝试在Angular 2的Kendo UI中使用新的多选组件,但当小部件启动时,Firebug中抛出了"this.value is undefined“错误。
<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
}发布于 2017-01-27 03:20:08
这可能是视图在数据到达之前呈现的问题,所以尝试这样放置一个ngIf:
<kendo-multiselect *ngIf="watchbills" name="watchbill" [data]="watchbills"
[(ngModel)]="selectedWatchbills" [textField]="'name'" [valueField]="'id'"></kendo-multiselect>它会等待数组watchbills中有值,然后再呈现包装在该标记中的任何内容。
https://stackoverflow.com/questions/41880003
复制相似问题