Skip to content

Instantly share code, notes, and snippets.

@jorupp
Created July 24, 2015 13:14
Show Gist options
  • Save jorupp/cf7077c7784ff77ee11a to your computer and use it in GitHub Desktop.
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
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