I'm creating a form with angular material mat-table.
I'm using reactive form while writing my app and the form initiation looks something like that:
myForm = this.fb.group({
settings: this.fb.array([])
});
my form is a formGroup which contains a formArray control (settings).
the settings formArray contains formGroup for each setting (each line in the mat-table is a formGroup and contains number of controls).
My problem starts when I'm trying to add validation to it.
If I just had a formGroup with formControl inside and one of them was Validators.required for example, the form was invalid until I added some value and then it would have changed to valid state.
However while using the formGroup inside the form array, Even after adding some value to the require field, the form states remain invalid (I even console log the form in order to see if the inner value was changed and it was).
In addition when I tried to catch the changes using valueChange().subscribe... the event was fired only when I pushed / removed groups from the formArray and never when existing control inside the setting group was changed.
How can I listen to inner change events in groups inside array and then use some custom valuations on them?