Home > front end >  How to add validation in nested array with different FormGroup?
How to add validation in nested array with different FormGroup?

Time:06-22

I have a complex array. I would like to add validation in "Apple Phone" as required field if the nested array selected "Apple" in "Electronic device". The problem is that it must be separate form Group. I have no idea how to add validation between different form group. Any others help?

Here is stackblitz

CodePudding user response:

Here is an example

What you have to do is create a function that returns a function, and provide the main form to this function.

To test this, select "iPhone 13", then change the quota of the first session. You will see the errors right below the model selector for convenience.

  • Related