如何启用活动表格领域?

时间:2018-01-17 20:16:19

标签: angular angular-reactive-forms

我在Angular 2+应用中使用了反应形式。我需要动态启用/禁用表单中的一个字段。

禁用我使用此代码: this.cardForm.get('cvc').disable();

效果很好。但我不知道如何启用。 我正在尝试:

  • this.cardForm.get(' CVC&#39)的removeAttribute。('禁用&#39); 但我明白了
  

属性' removeAttribute'在类型' AbstractControl'上不存在

  • this.cardForm.get(' CVC')启用();
  

无法调用类型缺少调用签名的表达式。输入'布尔'没有兼容的呼叫签名。

1 个答案:

答案 0 :(得分:0)

this.cardForm.get('cvc').enable()