在代碼中。我必須以反應形式設置控件的值。ngDoCheck() { setControlValues();}ngChanges(changes: SimpleChanges): void { setControlValues();}private setControlValues() { try { theForm.Controls['class'].setValue(myValue); //error happens here // ...many controls } catch(e) { console.log(e); }}但是我得到了例外。無法在 eval (forms.js:4852) at(forms.js:4873) at eval(forms.js.4793) at Array.forEach() at FormGroup._forEachChild 處讀取未定義的屬性“已啟用”..... .at FormControl.AbstractControl.updateValueAndValidity (forms.js: 3393)表格定義為theForm: FormGroup;constructor(private fb: FormBuilder) { this.useForm = this.fb.group({ class: [null] });}我的 html 是:<texearea kendoYextArea formControlName="class" required></textarea>更新:我發(fā)現(xiàn)庫中的 forms.js 代碼如下。 AbstractControl.prototype.updateValueAndValidty = function(opts) { if(opts == void 0) { opts = {}; } this._setInitialStatus(); if(this.enabled ) { this._cancelExistingSubscription();
無法讀取未定義的屬性“已啟用”
白衣非少年
2021-11-04 16:29:14