提到这个问题angularjs: directive creates two child scope。如何获得有问题的范围ID。
即。 范围(003),范围(004)等
答案 0 :(得分:14)
您可以通过控制台记录任何范围ID:
控制器:
function($scope){ //injected
console.log($scope.$id);
}
指令链接功能:
function(scope, element, attributes){
console.log(scope.$id);
}