在项目打包出现setControl报错解决方法:

对于用setControl设置多层级表单的值的用法,会出现这个报错:

以下是正确的写法:

get services(): FormArray {return this.sltForm.get("Service") as FormArray;}this.services.setControl("SvcInetUrl", this.fb.array(sltService.SvcInetUrl.map(url =>this.fb.group({url: [url.url, Validators.required],urlType: [url.urlType, Validators.required]}))));

如果直接设置SvcInetUrl就会出现报错:(示例报错代码)

this.sltForm.setControl("Service", this.fb.group({SvcInetUrl: this.fb.array(sltService.svcInetUrls.map(url =>this.fb.group({url: [url.url, Validators.required],urlType: [url.urlType, Validators.required]})))

Angular使用ng build打包报错 Property 'setControl' does not exist on type 'AbstractControl'.解决方法相关推荐

  1. linux服务器filesystem,linux mount报错:you must specify the filesystem type的解决方法

    最近工作中遇到一个问题,在linux mount /dev/vdb 到 /home分区时报错: # mount /dev/vdb /home mount: you must specify the f ...

  2. linux u盘 specify,linux mount报错:you must specify the filesystem type的解决方法

    最近工作中遇到一个问题,在linux mount /dev/vdb 到 /home分区时报错: # mount /dev/vdb /home mount: you must specify the f ...

  3. npm run build 打包报错primordials is not defined的解决方法

    npm run build 打包报错primordials is not defined的解决方法 D:\uniapp项目\huishua_web_agent>npm run build> ...

  4. Hive 启动报错java.net.URISyntaxException: Relative path in absolute URI 解决方法

    linux安装hive 遇到问题:Hive 启动报错java.net.URISyntaxException: Relative path in absolute URI 解决方法 方法记录 提示:这里 ...

  5. svn update 报错,必须先cleanup,然后cleanup失败解决方法

    svn update 报错,必须先cleanup,然后cleanup失败解决方法 参考文章: (1)svn update 报错,必须先cleanup,然后cleanup失败解决方法 (2)https: ...

  6. 安装linux 系统报错:No DEFAULT or UI configuration directive found 解决方法

    安装linux 系统报错:No DEFAULT or UI configuration directive found 解决方法 参考文章: (1)安装linux 系统报错:No DEFAULT or ...

  7. 【pycharm】pycharm上安装tensorflow,报错:AttributeError: module ‘pip‘ has no attribute ‘main‘ 解决方法

    [pycharm]pycharm上安装tensorflow,报错:AttributeError: module 'pip' has no attribute 'main' 解决方法 参考文章: (1) ...

  8. mycat重启报错Failed to connect to the Wrapper at port解决方法

    mycat重启报错Failed to connect to the Wrapper at port解决方法 参考文章: (1)mycat重启报错Failed to connect to the Wra ...

  9. maven文件报错(pom.xml或者jar包缺失)解决方法

    maven文件报错(pom.xml或者jar包缺失)解决方法 参考文章: (1)maven文件报错(pom.xml或者jar包缺失)解决方法 (2)https://www.cnblogs.com/wa ...

最新文章

  1. 第十六届全国大学智能汽车竞赛竞速比赛规则
  2. 恢复快速启动中的“显示桌面”按钮
  3. 《CLR Via C# 第3版》笔记之(十九) - 任务(Task)
  4. Java简介、安装及一些注意事项
  5. Swift面向对象基础(中)——Swift中的存储属性和计算属性
  6. Java编程思想—第八九章
  7. 基于ipv6的数据包分析(GNS3)
  8. exxi6.7如何传文件到win7_win7系统被删除文件如何恢复 恢复被删除的文件操作方法【详解】...
  9. 【单目标优化求解】基于matlab秃鹰算法(BES)求解最优目标问题【含Matlab源码 1546期】
  10. 【NLP】一文了解词性标注CRF模型
  11. 【计量经济学论文】近十年烟台港发展情况的计量分析(节选)
  12. 3000字神经网络论文
  13. Windows系统内置测试工具(winsat)
  14. 2019.10.26日常总结兼一码学成普及模拟4比赛选解
  15. AutoConfiguration排除指定和过滤自动配置组件
  16. 大数据学习资源最全版本(收藏)
  17. 小米android微博授权管理工具下载,微博推广:第三方微博工具,微博管理工具:微博粉丝管理工具!...
  18. 使用 Microsoft AI 打造你的首款智能机器人(入门只需要1小时)
  19. SQL dialect is not configured.
  20. 装载M1芯片的Mac安装“AE”时,出现错误代码“501”怎么办?

热门文章

  1. ActiveMQ学习:Hello ActiveMQ
  2. Support Web Application Projects
  3. linux计划任务与日志管理(日志分割/切割)
  4. Windows下Apache Tomcat 8安装配置
  5. dpkg: error: dpkg status database is locked by another process
  6. 解决C#程序只允许运行一个实例的几种方法详解
  7. swagger生成错误问题 汇总解决
  8. 虚拟机中PXE-MOF:Exiting intel PXE ROM.Operating system not found解决方法
  9. 线上 ELK 集群健康值 red 状态问题排查与解决
  10. 为什么base64编码的字符串的末尾有=符号