diff options
| author | Vojta Jina | 2011-11-30 12:23:58 -0800 |
|---|---|---|
| committer | Vojta Jina | 2012-01-23 11:11:27 -0800 |
| commit | 0196411dbe179afe24f4faa6d6503ff3f69472da (patch) | |
| tree | 8c79c809b884af8385ad2695c4885b18a5efa369 /src/widgets.js | |
| parent | 992c790f0786fa45c1cc3710f29bf49c7c322ba7 (diff) | |
| download | angular.js-0196411dbe179afe24f4faa6d6503ff3f69472da.tar.bz2 | |
refactor(scope.$watch): rearrange arguments passed into watcher (newValue, oldValue, scope)
As scopes are injected into controllers now, you have the reference anyway, so having scope as first argument makes no senseā¦
Breaks $watcher gets arguments in different order (newValue, oldValue, scope)
Diffstat (limited to 'src/widgets.js')
| -rw-r--r-- | src/widgets.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/widgets.js b/src/widgets.js index 6b3e93ee..53be8b14 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -111,7 +111,7 @@ angularWidget('ng:include', function(element){ var includeScope = scope.$eval(scopeExp); if (includeScope) return includeScope.$id; }, incrementChange); - this.$watch(function() {return changeCounter;}, function(scope, newChangeCounter) { + this.$watch(function() {return changeCounter;}, function(newChangeCounter) { var src = scope.$eval(srcExp), useScope = scope.$eval(scopeExp); @@ -233,8 +233,9 @@ angularWidget('ng:switch', function(element) { var changeCounter = 0; var childScope; var selectedTemplate; + var scope = this; - this.$watch(watchExpr, function(scope, value) { + this.$watch(watchExpr, function(value) { element.html(''); if ((selectedTemplate = casesTemplate[value] || defaultCaseTemplate)) { changeCounter++; @@ -577,7 +578,7 @@ angularWidget('ng:view', function(element) { changeCounter++; }); - this.$watch(function() {return changeCounter;}, function(scope, newChangeCounter) { + this.$watch(function() {return changeCounter;}, function(newChangeCounter) { var template = $route.current && $route.current.template; function clearContent() { @@ -802,7 +803,7 @@ angularWidget('ng:pluralize', function(element) { } else { return ''; } - }, function(scope, newVal) { + }, function(newVal) { element.text(newVal); }); }]; |
