.net - 如何修复“将值转换为类型时出错”
问题描述
我创建了一个动态表,可以添加行并通过输入和选择编辑所有行。要将新表数据发布到我的 web api 中,我使用 FormArray,如下所示:
public kommunikationseintraeges: FormArray = new FormArray([])
//My Form with also other data:
persoForm = new FormGroup({
...
kommunikationseinträges: this.kommunikationseintraeges,
..
})
//Thats how i push my already existing values into my table:
this.kType.forEach((singlekType:any) => {
this.kommunikationseintraeges.push(new FormGroup({
kommunikationsart: new FormControl(singlekType.kommunikationsart.bezeichnung),
kommunikationsort: new FormControl(singlekType.kommunikationsort.bezeichnung),
kommunikationsnummer: new FormControl(singlekType.nummerAdresse),
})
)
至少我像这样发布我的新数据:
onSubmit(){
this.pService.updateUser(this.person.personId, this.persoForm.getRawValue()).subscribe();
}
如您所见,我得到了没有任何数组的响应,但我试图用数组发布整个数据。我的数据如何来自我的数据库:
所以看来他目前无法处理我的阵列,但我不知道我应该如何修复它。
解决方案
推荐阅读
- java - 如何为线程运行方法编写junit测试用例
- mysql - 如何在sql中使用after插入触发器
- java - 初始化的文件可以为空吗?
- django - 我必须做些什么来更改最初需要使其成为可选的 Django ForeignKey?
- powershell - foreach 如果没有对象以值开头
- c# - 构建后修改WebHost配置,添加新添加文件的内容
- java - 如何构造创建Entry的接口
- c# - Powershell.Invoke() 结果为 0。
- asp.net-core - ASP.NET Core 从正文反序列化,带默认值
- javascript - ref 没有引用数组中的正确项