13

referring to this question angularjs: directive creates two child scope. How is it possible to get the scope id in question.

i.e. the Scope (003), Scope (004) etc

Community
  • 1
  • 1
mfc
  • 3,018
  • 5
  • 31
  • 43

1 Answers1

18

You can get any scopes id by console logging it:

Controller:

function($scope){ //injected
    console.log($scope.$id);
}

Directive link function:

function(scope, element, attributes){
    console.log(scope.$id);
}
Mathew Berg
  • 28,625
  • 11
  • 69
  • 90