我有一个使用 Kendo Angular Grid 控件的 Angular 4.10 应用程序。我正在使用外部编辑。我创建了 FormGroup 如下:
this.editForm = new FormGroup({
'Id': new FormControl({ value: 0, disabled: true }),
'Name': new FormControl("", Validators.compose([Validators.required, Validators.maxLength(30)])),
'BlindName': new FormControl({ value: "" }, Validators.compose([Validators.required, Validators.maxLength(30)])),
'UnitText': new FormControl(0),
'IsFromBsp': new FormControl(true),
'Disabled': new FormControl(false),
'SortOrder': new FormControl(0, Validators.compose([Validators.required, Validators.pattern('\\d')]))
});
我想做的是根据值 IsFromBsp 为字段 BlindName 设置禁用状态。就像是:
'BlindName': new FormControl({ value: "", disabled: this.IsFromBsp }, Validators.compose([Validators.required, Validators.maxLength(30)])),
有没有办法做到这一点?请告诉我。谢谢