You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There does not appear to be a way to fully reset a form. Using setValue on the controls doesn't update the dirty | touched state, so any validators that fail on empty get shown. It's also a bit awkward to have to manually re-define the values instead of having a one stop form.reset() method.
The text was updated successfully, but these errors were encountered:
I just found your blog post about this, and I know this is extremely premature seeing as I haven't looked through the repo, but if you are able to do this const controls = () => control().controls; then couldn't you create a for each loop that grabs all of the fields/ properties connected to controls and clear them out? I know it's probably a lot more complicated than that but I figured I'd at least ask.
Anyways thanks for making and sharing this component!
then couldn't you create a for each loop that grabs all of the fields/ properties connected to controls and clear them out?
Not sure who your comment is directed to, but yes it is possible to manually (re)set a form control to an arbitrary state. This is a request to add a convenience method to help with that.
There does not appear to be a way to fully reset a form. Using
setValue
on the controls doesn't update thedirty | touched
state, so any validators that fail on empty get shown. It's also a bit awkward to have to manually re-define the values instead of having a one stopform.reset()
method.The text was updated successfully, but these errors were encountered: