-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Support 'submit' updateOn trigger for forms when using ng-model-options #7017
Comments
Hi Shahar, As we discussed yesterday (and also on the old pull request, you can force all changes to take place when submitting using the existing code. I.e.: If you want to debounce the changes but trigger an immediate update on blur or when submitting you could do this: Another subject is decoupling the model update from validation as you suggest. This is a delicate issue because, until now, updates and validation take place at the same time. It's a nice idea though! |
There is an ongoing discussion on this on #6740. We could continue the brainstorming there if you like. |
@lrlopez - I tested |
You're right. I've just confirmed that At first sight we could use a simple solution: I.e.: Adding this to
On
And then, on the input directive:
Of course, assigning the form controller to the model controller is rough, but it's a first approximation 😄 What do you think? It's monkey patching, but it could work. |
Yes, this is more or less the direction I was going for. There are some edge cases to be considered here (for example, we want all the updating of the model to be done before |
So, running into this now - but is there an easy to to just tell inputs to not validate until submit? I'm using |
Running into this as well, 2 years later. Do we have a way to achieve this? |
The original use-case is definitely possible. If you use However, parsing and validation will also only happen then. This is a different issue that is tracked here: #7016 due to low demand, it hasn't been added. |
This seems important since when we have inputs that pend updates using
ng-model-options
we still want all changes to take place immediately if the form is submitted.I'll have a PR ready with this probably this week.
This can be also very useful since ppl will no longer need to have shadow copies of objects while they let users edit an object in a form. The changes will be flushed only when the form is submitted if they use something like
{updateOn: 'submit', validateOn: 'default'}
(see #7016)The text was updated successfully, but these errors were encountered: