Seeking assistance with implementing a clean and efficient method to trigger a function when anchor links, featuring a specific css class, are clicked.
While I could use ng-click
, I find it to be a messy and hard-to-maintain solution as it would require adding ng-click
to each individual anchor link I wish to monitor.
Here is an example of my current navigation links:
<li id="item1" class="foo"><a href="#/item1">CLICK ME</a></li>
I aim to replicate the functionality of ng-click
using a similar approach as shown in this JQuery snippet (which unfortunately does not work in my setup):
$('.foo a').on('click', function(){
//perform some actions
});
tl;dr
In search of an AngularJS solution that allows me to execute a function when an element with a specific css class is clicked.
Please inform me if my description needs further clarification.
Thank you in advance,
JohnD