I am facing a problem with ng-click
event. Below is my code. When I click on the element, it retrieves the span
tag and if I call currentTarget
, it gives the li
element. I want to get the <a>
element on ng-click
.And after getting element i have to check whether it has a class named 'havesub', How can I achieve it?
<li>
<a class="havesub" ui-sref="" ng-click="openmenu($event)">
<img src="images/icon-03.png" alt="menu" />
<span>Menu item1</span>
</a>
</li>
Below is my function in controller
app.controller("con", function($scope) {
$scope.openmenu = function($event) {
var targets = $event.currentTarget;
};
});