-
Notifications
You must be signed in to change notification settings - Fork 33
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
Default form values do not show #284
Comments
Hello, I just investigated this because indeed, it should definitely behave as you thought it should and have the default value. It took me a solid 5mn to realize that this is actually only an issue with the old API and that it works as expected with the new API :) The demo shows by default the old/deprecated API (we really need to remove it soon...). But instead if you go to |
Hi, thanks! |
Umh I guess it makes sense. Sub forms only broadcast their status if they're valid. It's a tough choice between having sub form values always up to date but possibly in an unwanted state, or always have them in an expected state, meaning that updates on a sub form that makes it invalid aren't propagated up (but the form status should be invalid!). So you could check if the root form is invalid (or even just the control of the sub form you're working with) and if it's invalid assume that it may be out of date for the value |
That's actually not what I meant. |
Can you provide a step by step repro please? With every possible details you've got. I'm not sure I understand |
Yep. I'll work on one next week and share it. |
Hi :)
Trying out the demo app, setting a default value for the FormControl does not appear to affect the UI (the input is empty).
Repro: in astromech-droid.component, set toolCount form control to:
new UntypedFormControl(10, { validators: [Validators.required] }),
.This is the result in the UI (notice the 'Number of tools carried' property is empty):
Is this behavior OK? How can I set default (and valid) values in the form.
The effect, by the way, is that without editing the form by hand, there are no values attached to the form value.
Thanks in advance.
The text was updated successfully, but these errors were encountered: