I\'ve been looking into modifying the AngularJS ng-click directive to add some additional features. I have a few different ideas of what to use it for, but a simple one is t
This is the correct updated version (improved from the answer):
$provide.decorator('ngClickDirective', function($delegate) {
var compile = $delegate[0].compile;
$delegate[0].compile = function() {
var link = compile.apply(this, arguments);
return function(scope, element, attrs, transclude) {
if (attrs.track !== undefined) {
element.bind('click', function() {
console.log('Tracking this');
});
}
return link.apply(this, arguments);
};
};
return $delegate;
});