-
Notifications
You must be signed in to change notification settings - Fork 23
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
Freezed default value #170
Comments
Hey |
hey @alejandrogiubel , did you find any solution. Thanks. |
@just-abdou not yet, just waiting for some update.
|
This also leads to returning null for non-nullable disabled fields when calling formModel.submit() although the disabled field has been annotated with @ Default(''). |
Checking your example |
|
Yes, you're right, I hadn't thought about that solution (very obvious btw). But in the case where you have a class with several parameters, including some required ones, it doesn't make much sense to define the required parameters at that moment when the idea is to init them when the form is valid. I think the most appropriate thing is that those class parameters that have a default value are initialized in the control with that value. If the idea is that the price is required but without a default value |
Currently it is an edgecase that is not handled so nicely your idea has an edge case. |
Hey @alejandrogiubel |
Hi @vasilich6107. I have tested the beta version and the result is very good. Thank you very much for the great work. Currently it is necessary to initialize the model for the form properties to be initialized, but there are cases where you would only want to partially initialize the model and not all the properties. For example
For the previous model need to do
to initialize the model. |
Hey @alejandrogiubel use this code
and check the generated |
Ok ok that's great. Thanks @vasilich6107 |
Using reactive form generator with freezed the default values that are set to freezed don't seem to work with reactive form, any ideas?
The text was updated successfully, but these errors were encountered: