I have a FormArray which will contain some price adjustment rules. Each rule will contain a FormGroup and each FormGroup with 4 FormControls. When I am trying to push the FormGroup into the FormArray getting this error:
Argument of type 'FormGroup' is not assignable to parameter of type 'never'.
public rules = new FormArray([]);
private getRuleFormGroup(): FormGroup {
return this._formBuilder.group({
from: new FormControl('', {
nonNullable: true,
validators: [Validators.required]
}),
to: new FormControl('', {
nonNullable: true,
validators: [Validators.required]
}),
increaseBy: new FormControl('', {
nonNullable: true,
validators: [Validators.required]
}),
increaseType: new FormControl('', {
nonNullable: true,
validators: [Validators.required]
})
});
}
private addNewRule(): void {
const group = this.getRuleFormGroup();
this.rules.push(group); //Getting error here
}