Ich arbeite an Angular Reactive Form. Dies ist meine Komponentenklasse Code:Ob ein FormControl-Wert ein Array sein kann?
ngOnInit(){
this.reviewForm = this.fb.group({
'controlArray': new FormArray([])
});
this.showDefaultForm();
}
addForm() {
(<FormArray>this.reviewForm.get('controlArray')).push(this.fb.group({
controlType: control.controlType,
options: control.options,
}));
}
I Typeerror bin immer: this.validator keine Funktion mit diesem ist. Ich denke, das liegt an der Zuweisung eines String-Arrays (d. H. Control.options) als Wert an FormControl. Wenn ich es zu einem FormArray mache, dann behebt dieser Fehler, aber ich habe ein Problem, um es als FormArray in Vorlage zu behandeln. Bitte sagen Sie mir, wenn ich FormArray nicht verwende, kann ich FormControl ein String-Array als Wert zuweisen? Wenn nein, dann wie man es als FormArray in der Vorlage behandelt. Danke