Why are multiple click events fired when using ngTouch?
http://stackoverflow.com/questions/21708730/why-are-multiple-click-events-fired-when-using-ngtouch/21766071#21766071
by Eduardo GarcĂa Sanz
HTML
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular-touch.js"></script>
<div ng-controller="Main">
<a href="#" ng-click="hi()">ngTouch</a>
<a href="#" myclick="hi()">myclick</a>
</div>
JavaScript
var app = angular.module('app', ['ngTouch']);
app.directive('myclick', function() {
return function(scope, element, attrs) {
element.bind('touchstart click', function(event) {
event.preventDefault();
event.stopPropagation();
scope.$apply(attrs['myclick']);
});
};
});
app.controller('Main', function ($scope) {
$scope.hi = function() {
alert('hi!');
};
});