你打电话时有问题
addOptions
表单数组内部:
component: this._formBuild.array([this.addOptions(x)])
添加选项
addOptionRow
addControl
addControl(x) {
const group = this._formBuild.group({
label: x.label,
cpv: x.cpv,
type: x.type,
mandatory: x.mandatory,
component: this._formBuild.array([])
});
const ctrl = group.controls.component as FormArray;
x.component.forEach(y => {
ctrl.push(this._formBuild.group({
value: y.value
}))
})
return group;
}
您的模板在其他方面是正确的,但要显示标签,请执行以下操作:
{{ answer.value.value }}
而不是
{{ answer.value }}