Skip to content

Instantly share code, notes, and snippets.

@matyasfodor
Created September 5, 2017 13:22
Show Gist options
  • Save matyasfodor/ed97fb440a1e1a3c17581c17961b96d8 to your computer and use it in GitHub Desktop.
Save matyasfodor/ed97fb440a1e1a3c17581c17961b96d8 to your computer and use it in GitHub Desktop.
// Hack for monkey patching $scope.$watch
this.$scope.$watch = ((originalWatchFn) => {
const scope = this.$scope;
// tslint:disable-next-line
return function(watchExpression, listener, objectEquality) {
// tslint:disable-next-line
const wrappedCB = function () {
console.log(watchExpression, arguments[0], arguments[1]);
listener.apply(null, arguments);
};
return originalWatchFn.apply(scope, [watchExpression, wrappedCB, objectEquality]);
};
})(this.$scope.$watch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment