一次禁用整个表单(Angular反应形式) [英] Disable the entire form at once (Angular reactive form)

查看:414
本文介绍了一次禁用整个表单(Angular反应形式)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用反应式表单时,是否有任何方法可以禁用整个表单。我知道可以让他们一个人禁用。

Is there any way to disable the entire form in angular when using Reactive forms. I know it is possible to make them disable one by one.

 this.tempForm = this.fb.group({
  m26_type:  '',
  m26_name:  ''
 })
this.tempForm.get('m26_type').disable();

是否可以禁用整个表单,而不是使每个控制器分别禁用?

Is it possible to disable the whole form rather than make every controller disable separately?

推荐答案

this.tempForm.disable();




禁用控件。这意味着该控件将免于
验证检查,并从任何父级的合计值中排除。
它的状态为DISABLED。

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.

LINK

更新

柱塞链接- https://plnkr.co/edit/CFC4uKpvfE4otJ2PWdkc?p=preview

这篇关于一次禁用整个表单(Angular反应形式)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆