diff options
| author | Vojta Jina | 2012-03-28 13:47:57 -0700 |
|---|---|---|
| committer | Igor Minar | 2012-03-29 07:30:32 -0700 |
| commit | f2106692b1ebf00aa5f8b2accd75f014b6cd4faa (patch) | |
| tree | 1a8c97e04014c559da4e7cc6877dbe34ce7d6783 /src/ng/directive/booleanAttrDirs.js | |
| parent | 4557881cf84f168855fc8615e174f24d6c2dd6ce (diff) | |
| download | angular.js-f2106692b1ebf00aa5f8b2accd75f014b6cd4faa.tar.bz2 | |
fix($compile): properly clone attr.$observers in ng-repeat
The `attr` object was only shallow copied which caused all observers to be shared.
Fixing similar issue in ng-* boolean attributes as well as ng-src and ng-href.
Diffstat (limited to 'src/ng/directive/booleanAttrDirs.js')
| -rw-r--r-- | src/ng/directive/booleanAttrDirs.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ng/directive/booleanAttrDirs.js b/src/ng/directive/booleanAttrDirs.js index 7da52db0..f79c02ce 100644 --- a/src/ng/directive/booleanAttrDirs.js +++ b/src/ng/directive/booleanAttrDirs.js @@ -283,9 +283,10 @@ forEach(BOOLEAN_ATTR, function(propName, attrName) { var normalized = directiveNormalize('ng-' + attrName); ngAttributeAliasDirectives[normalized] = function() { return { + priority: 100, compile: function(tpl, attr) { - attr.$observers[attrName] = []; return function(scope, element, attr) { + attr.$observers[attrName] = []; scope.$watch(attr[normalized], function(value) { attr.$set(attrName, value); }); @@ -301,9 +302,10 @@ forEach(['src', 'href'], function(attrName) { var normalized = directiveNormalize('ng-' + attrName); ngAttributeAliasDirectives[normalized] = function() { return { + priority: 100, compile: function(tpl, attr) { - attr.$observers[attrName] = []; return function(scope, element, attr) { + attr.$observers[attrName] = []; attr.$observe(normalized, function(value) { attr.$set(attrName, value); }); |
