2
我的API響應等動態嵌套形式控制角2
"groups": [{
"group_name": "GRP1"
"attributes": [{
"attribute_id": 1,
"attribute_name": "Frequency",
"value_reference": "tag"
}]
},
{
"group_name": "GRP2"
"attributes": [{
"attribute_id": 2,
"attribute_name": "Date",
"value_reference": "static",
"value_static_type": "date"
}]
}]
- 我怎樣才能在角4創建formConrol像
GroupName
List of Group's Attribute
GroupName
List of Group's Attribute
我的初始形式的控制顯示數據是像
this.editTemplateForm = this.fb.group({
groups: this.fb.group({
group_name: ['', Validators.required ],
attributes : this.fb.group({
value_reference : []
})
}),
});
我不明白如何動態添加控件
謝謝@JackKoppa的回覆。你的答案肯定會給我一些想法,以繼續我的API響應。我還發現了另一個有用的Plunker鏈接 - https://plnkr.co/edit/hpuPdh?p=preview。再次感謝 – Maher
抱歉,上面的鏈接是你的。我發現的是 - http://plnkr.co/edit/3k23R3z2KHlAXW5OLKRA?p=preview – Maher
不錯,那個plunk看起來也很適用。如果這個答案足夠了,請隨時將其標記爲已接受,並告訴我您是否有其他問題 –