I am in the process of developing an Angular library with the main feature being the provision of a selector with two inputs:
- a reactive form containing the data
- an object literal specifying which properties of the data should have editable input fields
Subsequently, the library will automatically generate the corresponding HTML code.
Here's the issue: in a project where the library, let's call it tester
, is being used, I have set up the reactive form to be passed into the library. The challenge arises when managing an array.
https://i.sstatic.net/TZ3A8.png
Within the library, I initially target the desired group using:
[formGroup]="myForm.options.form.controls.allFriends"
(seems to be functioning correctly)
Then, I attempt to access the array using:
[formArrayName]="myForm.options.form.controls.allFriends.controls.friends"
(this is where the error is encountered)
https://i.sstatic.net/fOr0O.png
Another aspect that appears peculiar is that a parent component already has
[formGroup]="myForm.options.form"
. However, I am unable to use formGroupName
alongside formGroup
(as seen a few lines above) due to an error regarding the absence of a formGroup
.
The situation may seem a bit intricate, so feel free to ask for further explanations if needed.