angular - Angular 8:在带有按钮错误代码的表单中添加输入字段
问题描述
您好,我需要使用按钮将输入字段添加到我的表单中。这是我的代码:stackblitz
我的代码中有一些错误。我在浏览器控制台中得到了这个:Cannot find control with name: '0'
并且AuditsComponent.html:9 ERROR TypeError: control.registerOnChange is not a function
在我的角度服务器中:ERROR in src/app/components/audits/audits.component.ts(50,26): error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'.
感谢您的贡献!
解决方案
我正在更正你的代码
https://stackblitz.com/edit/angular-hfrx5u
您必须在 app.module.ts 中安装导入
- 棱角材料
- 导入一个 MatInputModule
对于反应式表单输入 ReactiveFormsModule
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import {MatInputModule} from '@angular/material/input'; and in NgModule imports:[ BrowserModule, FormsModule, ReactiveFormsModule, MatInputModule],
推荐阅读
- c++ - 委托构造函数和引用参数
- sql - 无重复联合或连接查询
- docker - 无法使用 Google Cloud Kubernetes 替换
- python-3.x - 在 Python 中将列表连接成字符串
- android - 如何在 64 位设备(android)上运行颤振应用程序?
- android - Unity - 首次运行时未加载 Android 上的数据库
- tensorflow - 用 Tensorflow 解决有向图问题
- android-source - 在aosp中构建静态库
- css - vuetify 上有卡片页脚/卡片组功能吗?
- javascript - Javascript - 更新对象道具的功能