Select from following answers:- angular.element(document.getElementById(DOM ELEMENT ID)).scope().functionname();

- angular.element(document.getElementById(DOM ELEMENT ID)).functionname();
- angular(document.getElementById(DOM ELEMENT ID)).functionname();
- angularElement(document.getElementById(DOM ELEMENT ID)).scope().functionname();
- All Above
The angular.element(domElement).scope() gets the current scope for the element. Once the scope is determined, then we can invoke the function from the scope e.g.
Lets consider the below html:
<div ng-controller="testController" id="myDiv"></div>
Below is the way to access the function of controller from outside the angular scope.
angular.element(document.getElementById('myDiv')).scope().functionname();
Show Correct Answer
Asked In: Many Interviews |
Alert Moderator