Two-way bound attribute watcher not appearing dirty when it should #9821
Description
This example probably does a better job of describing the issue than I could: http://jsfiddle.net/ne74rdhg/ When you first click the button, the text does not appear. It appears on a second click. If you switch the same example from 1.3.0-beta.16
to 1.3.0-beta.15
, the button works as expected.
I spent some time looking into the issue, so let me write down my findings. But I'm not familiar with Angular's insides, so feel free to disregard my ramblings :).
The issue appears after @rodyhaddad 's 86d55c1. The commit has changed how nodeLinkFn
creates a watcher for =
. parentValueWatch
has become an interceptor. addInterceptor
is strange in that it will always return the pre-interceptor value if it was undefined.
In my JSFiddle greeting
starts out undefined. When it changes, parentValueWatch
copies it up into the controller's scope and returns the new value. But interceptedExpression
still returns undefined
, because the value was undefined
before running the interceptor. So the watcher is not dirty (it went from undefined
to undefined
), digest stops, and the change does not propagate into text
.