我是 angularjs 的新手,我知道 $scope
代表 Controller 和 View 之间的连接,但是除了寻找 class="ng-scope"
获取范围元素,我的意思是这样的:
function someControllerFunc($scope){
$scope.element;
}
我知道同一个 Controller 可以分配给多个范围,所以这可能是不可能的。
最佳答案
您可以将元素传递给 Controller ,就像作用域一样:
function someControllerFunc($scope, $element){
}
关于javascript - Angularjs:在 Controller 中获取元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21311401/