Disable Input fields in reactive form from type Script

If you want to disable some input of your formBuilder from the TS File , you can use this code :

name: [{value: '', disabled: true}, Validators.required],
name: [{value: '', disabled: this.isDisabled}, Validators.required],

Or

this.form.controls['name'].disable();

Laisser un commentaire