Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0ebfa0d

Browse files
rodyhaddadIgorMinar
authored andcommitted
perf($compile): watch interpolated expressions individually
1 parent 88c2193 commit 0ebfa0d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/ng/compile.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,9 +1804,9 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
18041804
bindings = parent.data('$binding') || [];
18051805
bindings.push(interpolateFn);
18061806
safeAddClass(parent.data('$binding', bindings), 'ng-binding');
1807-
scope.$watch(interpolateFn, function interpolateFnWatchAction(value) {
1807+
scope.$watchGroup(interpolateFn.expressions, interpolateFn.$$invoke(function(value) {
18081808
node[0].nodeValue = value;
1809-
});
1809+
}));
18101810
})
18111811
});
18121812
}
@@ -1867,7 +1867,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
18671867
attr[name] = interpolateFn(scope);
18681868
($$observers[name] || ($$observers[name] = [])).$$inter = true;
18691869
(attr.$$observers && attr.$$observers[name].$$scope || scope).
1870-
$watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) {
1870+
$watchGroup(interpolateFn.expressions, interpolateFn.$$invoke(function (newValue, oldValue) {
18711871
//special case for class attribute addition + removal
18721872
//so that class changes can tap into the animation
18731873
//hooks provided by the $animate service. Be sure to
@@ -1879,7 +1879,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
18791879
} else {
18801880
attr.$set(name, newValue);
18811881
}
1882-
});
1882+
}));
18831883
}
18841884
};
18851885
}

0 commit comments

Comments
 (0)