Angular 6 how to make all input's Not editable element inside a form

后端 未结 7 1372
孤街浪徒
孤街浪徒 2021-02-19 18:15

Is there a way to disable and make all fields non editable (input / mat-select / textfield / option/input/mat-checkbox etc) inside a Form

7条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-19 19:07

    Create a FormGroup as explained here:

    https://angular.io/guide/reactive-forms#add-a-formgroup

    Then, grab the formGroup instance programmatically and call .disable() on it, like this:

    this.leaseholderForm.disable()

提交回复
热议问题