-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Add option to write invalid $modelValues to scope #8290
Comments
I'll take a stab at this |
+1 logic using invalidated $modelValues is broken: http://codepen.io/ItsLeeOwen/pen/BcjDI |
just happened, I'm validating stuff server side, and when the user resubmit the form, it's gone, then the input becomes marked with required (since no data was sent to the server), even if I reset the validity state
|
Why can't or won't angular 1.3.x return to the days when invalid $modelValues were not undefined? |
@itsleeowen - this was never the case with builtin validators: http://codepen.io/anon/pen/jykGi |
@petebacondarwin I don't know whether the change in behavior has anything to do with validators, I suspect a change to ngModel.$setValidity because in this comparison between 1.2.x - 1.3.x I'm not using $validators, and only end up with undefined $modelValues in the 1.3.x branch. |
This option allows to write invalid values to the model instead of having them become undefined. Use this together with calling `ctrl.$setValidity` directly for displaying errors from serverside validation. Closes angular#8290 Closes angular#8313
This option allows to write invalid values to the model instead of having them become undefined. Use this together with calling `ctrl.$setValidity` directly for displaying errors from serverside validation. Closes angular#8290 Closes angular#8313
This option allows to write invalid values to the model instead of having them become undefined. Use this together with calling `ctrl.$setValidity` directly for displaying errors from serverside validation. Closes angular#8290 Closes angular#8313
This option allows to write invalid values to the model instead of having them become undefined. Use this together with calling `ctrl.$setValidity` directly for displaying errors from serverside validation. Closes angular#8290 Closes angular#8313
Since the validation refactoring, theoretically all invalid models appear in the input even if invalid. It's however not possible to write an invalid $modelValue to the scope. The $validators now actively set$modelValue to undefined when it is invalid, meaning that users cannot use the previous workarounds for this behavior. They now only have $ $invalidModelValue to get the raw value, but that is undocumented and quasi-private. Additionally, with $validators, it is not possible anymore to use a $parser to set the model even if invalid (another common workaround)
I propose we use
ng-model-options
to make it possible to write the parsed $modelValue to scope even if invalid.Why is this needed?
/cc @matsko @shahata @petebacondarwin @caitp
The text was updated successfully, but these errors were encountered: