-
Notifications
You must be signed in to change notification settings - Fork 27.4k
[1.3-beta16] ngModel $parsers regression vs. v1.2 #7965
Comments
Yes, it looks like facd904#diff-c244afd8def7f268b16ee91a0341c4b2R1759 introduced the change. It works with 1.3.0-beta.9, and there were no other changes related to forms. |
1f6a5a1 might provide a workaround with |
yes, of course. since we are testing I can look into this, but I'm not sure that this is the only point in |
The example provided by @mgcrea for example can be fixed easily by doing |
@shahata, yup, did patch AngularStrap with a proper workaround. Thanks! I do agree that the API usage was a bit far-fetched and I'm OK with the new behavior. |
@Narretz WDYT? I believe this is an acceptable breaking change and can be closed... |
It's nonsense to behave differently for objects and primitive values, but it's pretty terrible to make copies of objects to compare against, too, and we can't rely on better mechanisms in 1.x, and even those other mechanisms would be a bit heavy for this. It basically sucks no matter what. |
If the $viewValue is an object then we should trigger a model update if properties on that object change. Previously, we were only checking for change of object identity. Closes angular#7965
If the $viewValue is an object then we should trigger a model update if properties on that object change. Previously, we were only checking for change of object identity. Closes angular#7965
I have a proposed solution for this at #8047. Take a look. |
Having discussed this with @shahata, the feeling is that making a copy of the So the result is that directive developers (i.e. those writing custom input controls such as the date picker in this issue) are responsible for making a copy of their object before passing it to Of course, if the It would be good if someone could put together a docs PR that explained this - perhaps in the guide section? |
I'm having issues with the AngularStrap datepicker in the latest v1.3 beta.
Basically, I've found out that the ngModel $parsers won't be called if
$setViewValue
is called multiple times with the same value/reference. It was the case in the v1.2 branch.This is be problematic when we are using objects that change values but keep the same reference (such as Dates).
Check the following plunkers (console.warn):
Might be related to this commit
The text was updated successfully, but these errors were encountered: