perf($compile): watch interpolated expressions individually

This commit is contained in:
rodyhaddad
2014-03-06 16:00:27 -05:00
committed by Igor Minar
parent 88c2193c71
commit 0ebfa0d112

View File

@@ -1804,9 +1804,9 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
bindings = parent.data('$binding') || [];
bindings.push(interpolateFn);
safeAddClass(parent.data('$binding', bindings), 'ng-binding');
scope.$watch(interpolateFn, function interpolateFnWatchAction(value) {
scope.$watchGroup(interpolateFn.expressions, interpolateFn.$$invoke(function(value) {
node[0].nodeValue = value;
});
}));
})
});
}
@@ -1867,7 +1867,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
attr[name] = interpolateFn(scope);
($$observers[name] || ($$observers[name] = [])).$$inter = true;
(attr.$$observers && attr.$$observers[name].$$scope || scope).
$watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) {
$watchGroup(interpolateFn.expressions, interpolateFn.$$invoke(function (newValue, oldValue) {
//special case for class attribute addition + removal
//so that class changes can tap into the animation
//hooks provided by the $animate service. Be sure to
@@ -1879,7 +1879,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
} else {
attr.$set(name, newValue);
}
});
}));
}
};
}