Angularjs:获取控制器元素 [英] Angularjs: Get element in controller
本文介绍了Angularjs:获取控制器元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新来angularjs,我知道 $范围
重新present控制器和视图之间的连接,但有另外寻找一种方式类=NG-范围
来获取范围的元素,我的意思是这样的事情:
I am new to angularjs, I know that $scope
represent a connection between the controller and the view, But is there a way besides looking for class="ng-scope"
to get the scope element, I mean something like that:
function someControllerFunc($scope){
$scope.element;
}
我知道,同一个控制器可以被分配到多个领域,因此,也许这是不可能的,如果有谁知道一个办法做到这一点,我将非常感激,谢谢大家,有一个愉快的一天。
I know that same controller can be assigned to multiple scopes, So maybe it is not possible, If anyone know a way to do it i will be very thankful, Thank you all and have a nice day.
推荐答案
您可以在元素传递给控制器,就像范围:
You can pass in the element to the controller, just like the scope:
function someControllerFunc($scope, $element){
}
这篇关于Angularjs:获取控制器元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文