angular - 删除嵌套表单组内的对象
问题描述
我正在从事角度反应形式项目。我需要删除嵌套表单组中的对象
this.surveyForm = this.fb.group({
name: [null],
_id: [null],
question: [null],
from_list: [true],
type: CampaignActivityType.Survey,
questionList:this.fb.group({
question: ['', Validators.required],
answers:this.fb.group({
answer: ['', Validators.required]
});
});
)
});
我需要删除特定索引中的答案对象
解决方案
Try this:
//Remove:
this.surveyForm.get('answers').removeControl('answer');
推荐阅读
- php - 输入的文本应与相关的选择值一起显示
- php - 错误6:curl无法解析主机名
- python - 用python pandas中的数据框B的行替换数据框A的行子集
- sonarqube - 在 SonarQube 中更改项目的版本
- php - Laravel 中的 AJAX POST 请求
- dropbox-api - 使用 Dropbox 将 Autodesk Design Automation API DWG 转换为 PDF
- php - Joomla 组件媒体管理器将图像上传到错误的文件夹
- python-3.x - 如何让我的机器人离开其他服务器
- javascript - Javascript:删除浏览器控制台中输出数组的空白
- wordpress - WordPress 网站上的 JavaScript 问题