I am trying to call ng-click from a specific a-tag on the webpage from an injected script.
How could I find the exact a-tag from my page? I know if I had a class-name that I could write ($('a.classname')), but is there a way to find the tag which contains innerHTML Apple?
If not, would it be possible to call ng-click, as it is the 10th a-tag on the page? As a[10]?
Tag on page:
<a ng-click="myFunction()">Apple</a>
Injected script:
angular.element($('a')).scope().$apply(function() {
angular.element($('a')).scope().myFunction();
});
from an injected script. You may have too use $compile on the html element you receive.textContentincludes the wordapple.$('a').eq(9)[0].click(). If you want the scope it is assigned to the dom element, not a jQuery object.