[英]send checkbox value through formgroup in angular
我是 angular 的新手,我想在表单组中发送复选框值。 我在该字段中有 2 个复选框可以帮助我。
masterList: {
type: String,
read: true,
write: true
},
eventlist:{
type: String,
read: true,
},
feedBackSubmission: {
type: String,
read: true,
write: true
}
这是我的 json 我想发送他们的名字并从我的页面读取写入值
这是我的 html 代码
<tr>
<th style="border: 1px solid black;">Feedback Submission</th>
<td style="border: 1px solid black;"><input type="checkbox"></td>
<td style="border: 1px solid black;"><input type="checkbox" ></td>
</tr>
这是我的ts
roleForm = this.fb.group({
name: [null, [Validators.required]],
description: [null, [Validators.required]],
feedBackSubmission:[null,[Validators.required]],
// eventStatusList:[null,[Validators.required]],
// exercisestatus:[null,[Validators.required]],
// uservariableList:[null,[Validators.required]],
});
我想以表格形式发送这些复选框(真/假)的值
这是为了一张桌子? 如果是,您将需要一种不同的方法。
我根据 whitout 表制作。
HTML
<ng-container [formGroup]="roleForm">
<tr>
<th style="border: 1px solid black;">Feedback Submission</th>
<td style="border: 1px solid black;">
<input formControlName="feedBackSubmission" type="checkbox">
</td>
</tr>
</ng-container>
TS
this.roleForm = this.fb.group({
name: [null, [Validators.required]],
description: [null, [Validators.required]],
feedBackSubmission: [null, [Validators.required]]
});
形式价值
{
"name": null,
"description": null,
"feedBackSubmission": true
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.