Skip to content

Instantly share code, notes, and snippets.

@kentcdodds
Created June 21, 2014 03:51
Show Gist options
  • Save kentcdodds/b62eb453520783b9f141 to your computer and use it in GitHub Desktop.
Save kentcdodds/b62eb453520783b9f141 to your computer and use it in GitHub Desktop.
A method for hijacking the $new of scopes.
// How bad is this? Do you see any problems with doing this?
var scopePrototype = Object.getPrototypeOf($rootScope);
var oldNew = scopePrototype.$new;
// hijack the prototype's $new
scopePrototype.$new = function $new() {
var scope = oldNew.apply(this, arguments);
addFunctionality(scope);
return scope;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment