Skip to content

Commit 4ad0ca1

Browse files
refactor($compile): check removeWatches before calling
Previously we assigned `noop` if there was no function but there is no performance advantage in doing this since the check would have to happen either at assignment time or at call time. Removing this use of `noop` makes the code clearer, IMO :-) Closes angular#12528
1 parent b51dd30 commit 4ad0ca1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ng/compile.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
20732073
controllerForBindings = controller;
20742074
removeControllerBindingWatches =
20752075
initializeDirectiveBindings(scope, attrs, controller.instance,
2076-
bindings, scopeDirective) || noop;
2076+
bindings, scopeDirective);
20772077
}
20782078
}
20792079
for (i in elementControllers) {
@@ -2087,7 +2087,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
20872087
$element.data('$' + i + 'Controller', controllerResult);
20882088
if (controller === controllerForBindings) {
20892089
// Remove and re-install bindToController bindings
2090-
removeControllerBindingWatches();
2090+
removeControllerBindingWatches && removeControllerBindingWatches();
20912091
removeControllerBindingWatches =
20922092
initializeDirectiveBindings(scope, attrs, controllerResult, bindings, scopeDirective);
20932093
}

0 commit comments

Comments
 (0)