我想动态创建formControlName,这是我在组件中的代码,
控制器代码
ngOnInit() {
this.rForm = this.fb.group({
question_type_id: this.fb.array([]),
});
for (let i = 0; i < this.getQuestionsType.length; i++) {
const control = <FormArray>this.rForm.controls['question_type_id'];
control.push(this.initAddress(i));
}
}
initAddress(i) {
var ans = "is_answer_"+i;
return this.fb.group({
ans: ['']
});
}
所以我想要formControlName像这样,
is_answer_0
is_answer_1
is_answer_2