diff options
| author | Daniel Tabuenca | 2013-11-27 22:01:22 -0800 | 
|---|---|---|
| committer | Tobias Bosch | 2013-12-04 09:45:20 -0800 | 
| commit | 2d0f6ccba896fe34141d6d4f59eef6fba580c5c2 (patch) | |
| tree | f5f6601b36f82005f643435696319444af7acdf4 /src/ng/compile.js | |
| parent | 9a81b8668a9ee13cdea305d85325efa3efdfc01e (diff) | |
| download | angular.js-2d0f6ccba896fe34141d6d4f59eef6fba580c5c2.tar.bz2 | |
fix($compile): ensure isolated local watches' lastValue is always in sync
When using two-way binding with isolate scope, under some circumstances
the lastValue variable captured in the parentValueWatch function can get
out of sync.
Specifically, if both the value in the origin scope as well as the value
in the isolate scope get independently updated to the same value within
one digest cycle, the lastValue is never updated. This potentially causes
the watch to make the wrong decision as to which side to update on subsequent
passes.
This fixes things by ensuring lastValue is always set to the last seen
value even if the watch's logic was short circuited because there was no
difference between the values in the original and isolate scopes.
Closes #5182
Diffstat (limited to 'src/ng/compile.js')
| -rw-r--r-- | src/ng/compile.js | 6 | 
1 files changed, 3 insertions, 3 deletions
| diff --git a/src/ng/compile.js b/src/ng/compile.js index 0963b8d5..fd8a8729 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -1438,13 +1438,13 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {                      // we are out of sync and need to copy                      if (parentValue !== lastValue) {                        // parent changed and it has precedence -                      lastValue = isolateScope[scopeName] = parentValue; +                      isolateScope[scopeName] = parentValue;                      } else {                        // if the parent can be assigned then do so -                      parentSet(scope, parentValue = lastValue = isolateScope[scopeName]); +                      parentSet(scope, parentValue = isolateScope[scopeName]);                      }                    } -                  return parentValue; +                  return lastValue = parentValue;                  });                  break; | 
