I'm wondering is a way to add an ng-click as an attribute?
Let's say I want to add ng-click if my <li> has a class someClass:
angular.element(root.querySelector('li.someClass').attr({'ng-click': 'someFunc()'});
And when <li> has a class anotherClass I want to reset the ng-click:
angular.element(root.querySelector('li.someClass').attr({'ng-click': ''});
But it didn't work.
I can't make it in my HTML:
<li class="someClass" ng-click="someFunc()"> ... </li>
<li class="anotherClass"> ... </li>
because my HTML is generated dynamically by ng-repeat and also there is a directive which make some mess with ng-hide.
The best solution will be with the angular.element but ng-click isn't an attribute right?
(I can debug the code in Visual Studio and when I add ng-click in a way <li ng-click="someFunc()">...</li> I can't find it in the Locals Window in VS)