Is there a way to disable and make all fields non editable
(input / mat-select / textfield / option/input/mat-checkbox etc)
inside a Form
If you are using reactive form you can achieve this programmatically like this (one-by-one approach):
this.formGroupName.controls[controlNmae].disable();
Eg: this.formGroupName.controls['lastName'].disable()
To disable all at once:
this.formGroupName.disable()
In your case do: this.leaseholderForm.disable()
And to turn it back do: this.leaseholderForm.enable()
What you can do is create a function like this and call it after you have called createLeaseholderForm()
:
disableForm() {
this.leaseholderForm.disable()
}
for more info read this.