-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Unintended breaking change when passing ngModel as a binding #15833
Comments
Removing the quotes resolves the issue: |
Removing the quotes doesn't solve the problem. It makes the error go away, but the component deoes not work. The reason this breaks is that (since 9e24e77) we put the scope on the @jbedard, thoughts? |
This is something that always bugs me with Angular(js) DI. You must store injected things on the instance in cases like this even though they are the same or every instance (within that angular app). I don't think people should be watching the full |
I know what you mean, but in this case it is not the same on every instance (that's why you need to store it on the instance) 😃 The problem came up when passing the I just realized this is only a problem if you have an array or object literal. This will work correctly on 1.7.x (thanks to #15301), but not on 1.6.x 😞 |
All I can think of is doing |
For the record, here are the alternative solutions we discussed:
|
A workaround has been added to 1.6.x. Tests added to 1.7 to confirm that this no longer happens in this specific case (ng-model in an object literal). If you manually deep watch an mg-model it will still occur but I don't think we want to fix that. |
Note: for support questions, please use one of these channels: https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#question. This repository's issues are reserved for feature requests and bug reports.
Do you want to request a feature or report a bug?
bug
What is the current behavior?
The following code throws an error with AngularJS 1.6.2 but not with 1.5.8 (I haven't checked other versions yet):
The error:
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (template: http://plnkr.co/edit/tpl:yBpEi4).
Reproduce:
https://plnkr.co/edit/dAqZuQP4e9Gk1wc6c1sw?p=preview (AngularJS 1.6.2 not working)
https://plnkr.co/edit/nuXCMcYoJUGJ4xucmhqC?p=preview (AngularJS 1.5.8 working)
What is the expected behavior?
No error as in the 1.5.x version.
What is the motivation / use case for changing the behavior?
Which versions of AngularJS, and which browser / OS are affected by this issue? Did this work in previous versions of AngularJS? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.
Other information (e.g. stacktraces, related issues, suggestions how to fix)
The text was updated successfully, but these errors were encountered: