如何启用反应形式的领域?
How to enable a field of reactive forms?
我在 Angular 2+ 应用程序中使用响应式表单。我需要动态启用/禁用表单的一个字段。
对于禁用,我正在使用此代码:
this.cardForm.get('cvc').disable();
效果不错。但我不知道如何启用。
我正在尝试:
- this.cardForm.get('cvc').removeAttribute('disabled');
但我得到 ts eror
Property 'removeAttribute' does not exist on type 'AbstractControl'
- this.cardForm.get('cvc').enabled();
Cannot invoke an expression whose type lacks a call signature. Type 'Boolean' has no compatible call signatures.
this.cardForm.get('cvc').enable()
我在 Angular 2+ 应用程序中使用响应式表单。我需要动态启用/禁用表单的一个字段。
对于禁用,我正在使用此代码:
this.cardForm.get('cvc').disable();
效果不错。但我不知道如何启用。 我正在尝试:
- this.cardForm.get('cvc').removeAttribute('disabled'); 但我得到 ts eror
Property 'removeAttribute' does not exist on type 'AbstractControl'
- this.cardForm.get('cvc').enabled();
Cannot invoke an expression whose type lacks a call signature. Type 'Boolean' has no compatible call signatures.
this.cardForm.get('cvc').enable()