FormGroup:
A FormGroup aggregates the values of each child FormControl into one
object, with each control name as the key.
const form = new FormGroup({
first: new FormControl('Nancy', Validators.minLength(2)),
last: new FormControl('Drew')
});
FormArray:
A FormArray aggregates the values of each child FormControl into an
array.
const arr = new FormArray([
new FormControl('Nancy', Validators.minLength(2)),
new FormControl('Drew')
]);
When should one be used over the other?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…