This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Outer change is stronger than the inner one when they are both changed and using one-way binding #14546
Comments
If you use $onChanges, you can set the bound value in the component, because then one update cycle is complete. Setting in the constructor will never work, because the binding hasn't been done yet. I'm not sure if $onInit should work (it doesn't). @petebacondarwin wdyt? |
This does seem a little buggy. As @Narretz points out it will never work in the constructor. But I think we ought to get it to work elsewhere... |
By the way, outer change is always going to be stronger than inner change. This is the meaning of one-way in this case. That being said, I think there is a problem with the initial change recording. It seems to call |
petebacondarwin
added a commit
to petebacondarwin/angular.js
that referenced
this issue
May 10, 2016
The watch handler was triggering on its first invocation, even though its change had already been dealt with when setting up the binding. Closes angular#14546
2 tasks
petebacondarwin
added a commit
to petebacondarwin/angular.js
that referenced
this issue
May 10, 2016
The watch handler was triggering on its first invocation, even though its change had already been dealt with when setting up the binding. Closes angular#14546
petebacondarwin
added a commit
to petebacondarwin/angular.js
that referenced
this issue
May 10, 2016
The watch handler was triggering on its first invocation, even though its change had already been dealt with when setting up the binding. Closes angular#14546
petebacondarwin
added a commit
to petebacondarwin/angular.js
that referenced
this issue
May 10, 2016
The watch handler was triggering on its first invocation, even though its change had already been dealt with when setting up the binding. Closes angular#14546
petebacondarwin
added a commit
to petebacondarwin/angular.js
that referenced
this issue
May 10, 2016
The watch handler was triggering on its first invocation, even though its change had already been dealt with when setting up the binding. Closes angular#14546
petebacondarwin
added a commit
to petebacondarwin/angular.js
that referenced
this issue
May 10, 2016
The watch handler was triggering on its first invocation, even though its change had already been dealt with when setting up the binding. Closes angular#14546
petebacondarwin
added a commit
to petebacondarwin/angular.js
that referenced
this issue
May 10, 2016
The watch handler was triggering on its first invocation, even though its change had already been dealt with when setting up the binding. Closes angular#14546
petebacondarwin
added a commit
to petebacondarwin/angular.js
that referenced
this issue
May 10, 2016
The watch handler was triggering on its first invocation, even though its change had already been dealt with when setting up the binding. Closes angular#14546
petebacondarwin
added a commit
to petebacondarwin/angular.js
that referenced
this issue
May 10, 2016
The watch handler was triggering on its first invocation, even though its change had already been dealt with when setting up the binding. Closes angular#14546
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Do you want to request a feature or report a bug?
Bug (?)
What is the current behavior?
I'm not sure if bug or by design, but when using one-way (
<
), if both the outer and inner scope have been changed, the outer is stronger, even if the inner's change happened after the outer one.http://jsbin.com/zunoraquju/1/edit?html,js,output
What is the expected behavior?
I would simply expect that the last change is stronger, that's what happens till now with two-way (
=
). You can change my attached example to=
and it will work.What is the motivation / use case for changing the behavior?
Actually a common case - if the passed value is
X
I want to change it to beY
(in constructor /$onInit
) and display it, but preserve the one-way so the outer scope won't get the update.Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.
1.5+
Other information (e.g. stacktraces, related issues, suggestions how to fix)
Relevant test (I would expect it to be
misko
)The text was updated successfully, but these errors were encountered: