Created
June 21, 2014 03:51
-
-
Save kentcdodds/b62eb453520783b9f141 to your computer and use it in GitHub Desktop.
A method for hijacking the $new of scopes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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