javascript - element onClick not working with ngClick -
i have attribute directive following code:
return { restrict: 'a', priority: 1000, link: function (scope, $element) { $timeout(function () { $($element).on('click','li', function ($event) { alert('hi'); }); }); } }; this html i'm trying use on:
<ul some-directive> <li ng-click="somefunc()"></li> <li ng-click="somefunc()"></li> <li ng-click="somefunc()"></li> </ul> the thing on li elements using ngclick directives call other function. noticed long ngclick directives there directive onclick method never gets called.
any way make both ngclick , onclick trigger? seems ngclick overriding directive's onclick.
i'm still not quite sure why need 2 clickhandler? include <span> inside <li> , attach onclick or ng-click method on span. like:
<li mydirective=""><span ng-click="handleclick()">your content here</span></li> the content of <li> element goes inside <span> then.
Comments
Post a Comment