Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 14:04
What would you like to do?
Event delegation in AngularJS
var app=angular.module('myApp', []);
app.directive('exampleDirective1', function() {
return {
restrict: 'E',
template: '<span>Click me! [{{clickCount}}]</span>',
replace: true,
link: function(scope, elm, attrs) {
scope.clickCount = 0;
elm.bind('click', 'span', function() {
scope.$apply(function() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment