我目前正在使用Angular的KendoUI组件开发Angular 2(4)上的应用程序 .
现在我试图用DropdownList实现简单的表单 . 该下拉列表的数据是从远程api加载的 . 问题是,当打开下拉列表时,我收到一个非常令人困惑的错误:
ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'undefined'. Current value: '590px'.
我没有在Angular中获得任何帮助,所以任何帮助都将受到赞赏 .
加价:
<kendo-dropdownlist formControlName="parentCompanyId" class="form-control" [valuePrimitive]="true" [data]="parentCompanys"
textField="name" valueField="id" ></kendo-dropdownlist>
组分(简化):
export class EmployerComponent implements AfterViewInit {
public Employer: Employer = new Employer();
public employerForm: FormGroup;
public parentCompanys: Array<any> = [];
constructor(private employersService: EmployersService) {
}
ngOnInit() {
this.employerForm = new FormGroup({
parentCompanyId: new FormControl(this.Employer.ParentCompanyId, [
Validators.required
])
});
}
ngAfterViewInit() {
this.employersService.getCompanies().subscribe(response => {
this.parentCompanys = response.data;
});
}
}
UPD:04.07.2017
我花了一些时间试图用评论中提到的问题的不同解决方案来解决这个问题(link),但没有任何成功 .
但是今天我已经更新了我的kendo-ui软件包,似乎错误消失了 . 我不确定,但看起来它是kendo-ui组件中的一个错误 .
我所相信的链接与这个问题有关