diff options
| -rw-r--r-- | src/ng/compile.js | 6 | ||||
| -rwxr-xr-x | test/ng/compileSpec.js | 18 | 
2 files changed, 21 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; diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 6de96f65..c017bfa6 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -2386,6 +2386,24 @@ describe('$compile', function() {          expect(componentScope.refAlias).toBe($rootScope.name);        })); +      it('should not break if local and origin both change to the same value', inject(function() { +        $rootScope.name = 'aaa'; + +        compile('<div><span my-component ref="name">'); + +        //change both sides to the same item withing the same digest cycle +        componentScope.ref = 'same'; +        $rootScope.name = 'same'; +        $rootScope.$apply(); + +        //change origin back to it's previous value +        $rootScope.name = 'aaa'; +        $rootScope.$apply(); + +        expect($rootScope.name).toBe('aaa'); +        expect(componentScope.ref).toBe('aaa'); +      })); +        it('should complain on non assignable changes', inject(function() {          compile('<div><span my-component ref="\'hello \' + name">');          $rootScope.name = 'world'; | 
