Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 8928d02

Browse files
PatrickJSpetebacondarwin
authored andcommitted
perf(ngStyleDirective): use $watchCollection
Since we are simply watching a flat object collection it is more performant to use $watchCollection than a deepWatch... Closes #10535
1 parent 5bb2636 commit 8928d02

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ng/directive/ngStyle.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@
4747
</example>
4848
*/
4949
var ngStyleDirective = ngDirective(function(scope, element, attr) {
50-
scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {
50+
scope.$watchCollection(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {
5151
if (oldStyles && (newStyles !== oldStyles)) {
5252
forEach(oldStyles, function(val, style) { element.css(style, '');});
5353
}
5454
if (newStyles) element.css(newStyles);
55-
}, true);
55+
});
5656
});

0 commit comments

Comments
 (0)