From 0ebfa0d112c8ba42242cb8353db91e93eb42b463 Mon Sep 17 00:00:00 2001 From: rodyhaddad Date: Thu, 6 Mar 2014 16:00:27 -0500 Subject: [PATCH] perf($compile): watch interpolated expressions individually --- src/ng/compile.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ng/compile.js b/src/ng/compile.js index 41c45f5b0661..78479722009a 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -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); } - }); + })); } }; }