Disable Input fields in reactive form

后端 未结 16 1078
暖寄归人
暖寄归人 2020-12-22 20:28

I already tried to follow the example of other answers from here and I did not succeed!

I created a reactive form (ie, dynamic) and I want to disable some fields at

16条回答
  •  星月不相逢
    2020-12-22 20:57

    this.form.enable()
    this.form.disable()
    

    Or formcontrol 'first'

    this.form.get('first').enable()
    this.form.get('first').disable()
    

    You can set disable or enable on initial set.

     first: new FormControl({disabled: true}, Validators.required)
    

提交回复
热议问题