gpt4 book ai didi

angularjs - 如何获取 angularjs 范围 id

转载 作者:行者123 更新时间:2023-12-02 19:14:42 26 4
gpt4 key购买 nike

引用这个问题angularjs: directive creates two child scope 。如何才能获得有问题的范围 ID。

范围 (003)范围 (004)

最佳答案

您可以通过控制台记录来获取任何范围 ID:

Controller :

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

指令链接功能:

function(scope, element, attributes){
console.log(scope.$id);
}

关于angularjs - 如何获取 angularjs 范围 id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32119260/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com