Created
July 24, 2015 13:14
-
-
Save jorupp/cf7077c7784ff77ee11a to your computer and use it in GitHub Desktop.
Dumps out some information about a passed angular scope and it's connectivity to parents up the tree to the root
This file contains 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
function debugScope(scope) { | |
function isInParent(scope) { | |
var parent = scope.$parent; | |
if(!parent) return false; | |
var s = parent.$$childHead; | |
while(s) { | |
if(s == scope) return true; | |
s = s.$$nextSibling; | |
} | |
return false; | |
} | |
while(scope) { | |
console.log(scope.$id, isInParent(scope), scope == scope.$root, scope); | |
scope = scope.$parent; | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment