在使用 Reactive 表单时,有没有办法以 Angular 禁用整个表单。我知道可以让它们一个一个地禁用。
this.tempForm = this.fb.group({
m26_type: '',
m26_name: ''
})
this.tempForm.get('m26_type').disable();
是否可以禁用整个表单而不是单独禁用每个 Controller ?
最佳答案
this.tempForm.disable();
Disables the control. This means the control will be exempt from validation checks and excluded from the aggregate value of any parent. Its status is DISABLED.
If the control has children, all children will be disabled to maintain the model.
更新
Plunker 链接 - https://plnkr.co/edit/CFC4uKpvfE4otJ2PWdkc?p=preview
关于angular - 一次禁用整个表单(Angular reactive form),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45854017/