Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polymorphic sub forms without form controls #302

Open
avivs100 opened this issue Sep 19, 2023 · 2 comments
Open

Polymorphic sub forms without form controls #302

avivs100 opened this issue Sep 19, 2023 · 2 comments

Comments

@avivs100
Copy link

Hi, I created a form with the help of your library and it is amazing and very clear.
I ran into a small problem that you might be able to help me with because I couldn't find a solution.
The problem is this: There is a form, one of whose controls is polymorphic. The user has to select a type of product from a dropdown and according to the type, an appropriate sub form should be opened.
The sub forms that define form controls work fine, but the sub forms that do not define controls are not working properly (the purpose of such sub forms is only to build the appropriate dto for them by using toFormGroup and fromFormGroup).
Apparently there is a problem with the return value of those subforms (with no controls) because no translation is performed because it actually returns Null.
Are you familiar with the problem? Is there a solution you know about? Or maybe some workaround?
Thank you very much

@maxime1992
Copy link
Contributor

Hello, polymorphism is well supported. You will be able to find plenty of examples looking in that folder (and you can compare the actual app visually if you'd like here).

If something isn't still working after that, please provide A MINIMAL repro on Stackblitz. And I insist on MINIMAL. Thanks!

@avivs100
Copy link
Author

avivs100 commented Dec 4, 2023

Hi, I created A simple example of a form with sub form(with two polymorphic forms). 1 of them is without controls. In the code you can see my problem, if you will select Honda First the form will not be valid but if you choose first Toyota and then Honda it will work.
the selection of the Honda need to be valid without choosing the Toyota first.
App URL: https://stackblitz.com/edit/angular-ivy-nzakgy
Thank you very much. @maxime1992

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants