我是否有可能能够基于Angular反应形式的某些条件添加行?如果是,请帮助我。我已经在我的堆叠闪电战中开始了它。请检查此链接 https://stackblitz.com/edit/dynamically-add-rows
this.addForm.get("items").valueChanges.subscribe(val => {
console.log(val);
if (val === true) {
this.addForm.get("items_value").setValue("yes");
// How to add row here?
this.addForm.addControl(rows, 'rows')
}
if (val === false) {
this.addForm.get("items_value").setValue("no");
// How to remove row here?
this.addForm.removeControl(rows, 'rows')
}
});
答案 0 :(得分:1)