Aviel Fedida Aviel Fedida - 5 months ago 59
Javascript Question

Angularjs: Get element in controller

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.

Answer

You can pass in the element to the controller, just like the scope:

function someControllerFunc($scope, $element){

}