In the link function, is there a more "Angular" way to bind a function to a click event?
Right now, I'm doing...
myApp.directive('clickme', function() {
return function(scope, element, attrs) {
scope.clickingCallback = function() {alert('clicked!')};
element.bind('click', scope.clickingCallback);
} });
Is this the Angular way of doing it or is it an ugly hack? Perhaps I shouldn't be so concerned, but I'm new to this framework and would like to know the "correct" way of doing things, especially as the framework moves forward.
bind
does to start adigest
cycle; which might be something you might want as well, but be aware. – Umur Kontacı May 12 '14 at 15:12bind
does not start the digest cycle? – demisx May 30 '14 at 1:16