aboutsummaryrefslogtreecommitdiffstats
path: root/src/widget
diff options
context:
space:
mode:
authorVojta Jina2011-11-30 12:23:58 -0800
committerVojta Jina2012-01-23 11:11:27 -0800
commit0196411dbe179afe24f4faa6d6503ff3f69472da (patch)
tree8c79c809b884af8385ad2695c4885b18a5efa369 /src/widget
parent992c790f0786fa45c1cc3710f29bf49c7c322ba7 (diff)
downloadangular.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/widget')
-rw-r--r--src/widget/form.js2
-rw-r--r--src/widget/input.js4
-rw-r--r--src/widget/select.js2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/widget/form.js b/src/widget/form.js
index f3134db4..962cb6b8 100644
--- a/src/widget/form.js
+++ b/src/widget/form.js
@@ -99,7 +99,7 @@ angularWidget('form', function(form){
watch('valid');
watch('invalid');
function watch(name) {
- form.$watch('$' + name, function(scope, value) {
+ form.$watch('$' + name, function(value) {
formElement[value ? 'addClass' : 'removeClass']('ng-' + name);
});
}
diff --git a/src/widget/input.js b/src/widget/input.js
index 5db52704..e666a0c1 100644
--- a/src/widget/input.js
+++ b/src/widget/input.js
@@ -796,7 +796,7 @@ angularWidget('input', function(inputElement){
});
forEach(['valid', 'invalid', 'pristine', 'dirty'], function(name) {
- widget.$watch('$' + name, function(scope, value) {
+ widget.$watch('$' + name, function(value) {
inputElement[value ? 'addClass' : 'removeClass']('ng-' + name);
});
});
@@ -870,7 +870,7 @@ function watchElementProperty(modelScope, widget, name, element) {
!!element[0].attributes[name])
: element.attr(name);
if (bindAttr[name] && match) {
- modelScope.$watch(match[1], function(scope, value){
+ modelScope.$watch(match[1], function(value) {
widget['$' + name] = isBoolean ? !!value : value;
widget.$emit('$validate');
widget.$render && widget.$render();
diff --git a/src/widget/select.js b/src/widget/select.js
index b0f5eac5..a3633ddd 100644
--- a/src/widget/select.js
+++ b/src/widget/select.js
@@ -167,7 +167,7 @@ angularWidget('select', function(element){
});
forEach(['valid', 'invalid', 'pristine', 'dirty'], function(name) {
- widget.$watch('$' + name, function(scope, value) {
+ widget.$watch('$' + name, function(value) {
selectElement[value ? 'addClass' : 'removeClass']('ng-' + name);
});
});