Created
April 30, 2015 21:04
-
-
Save jonocairns/da071b3f1326e8357eee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module app.common { | |
export function stopEvent(): ng.IDirective { | |
return { | |
restrict: 'A', | |
link: (scope: any, element: any) => { | |
element.bind('click', (event: any) => { | |
// other ng-click handlers shouldn't be triggered | |
event.stopPropagation(event); | |
}); | |
} | |
}; | |
} | |
angular | |
.module('app.common') | |
.directive('stopEvent', stopEvent); | |
} | |
// usage | |
// <button><button stop-event></button></button> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment