angular - 当在 FormControlName 上调用 disabled() 使整个表单无效时如何解决?
问题描述
我正在使用反应形式,当我使 formControlName 禁用()时,整个表单无效。我想在禁用后有效。
console.log('Before:'+ (this.form.valid));
this.form.controls['formControlName1'].disable();//calling in onInit()
console.log('After:'+(this.form.valid));
output-:
Before:true
After:false.
解决方案
formControlName.disable({onlySelf: true});
推荐阅读
- c# - 带有 AtomFeed RSS 提要的 ASP.NET 网页加载时间太长
- kernel - sys/kernel/debug/krpobes/list 为空
- c++ - 你如何在一个类中注入依赖项,它依赖于一个类,它依赖于 C++ 中的另一个类?
- nginx - 如何在 NGINX 上阻止 GET 获取特定目录?(通过推荐人或用户代理)
- wifi - 如何在 ESP32 中配置异步 Web 服务器?
- amazon-web-services - 跨多个 Lambda 函数的 AWS X-Ray 跟踪
- python - 如何根据熊猫中的其他列映射值?
- javascript - 从一页跳转到另一页时,如何使用 localStorage 中的数据?
- google-sheets - 输出多列而不是多行
- python - 对 Odoo 数据进行 sql 查询