Igor Simic
4 years ago

How to fix Angular ng-click not working on mobile touch




If your ng-click is not working on mobile touch event, it is because most likely ng-click module is using 'click' event instead of 'touchend' or 'touchstart'. So we have to modify module and use touchend:

angular.module('ngClick', function( $location ) { 
	return { 
		link: function(scope, elem, attrs) { 
			if(attrs.href) { elem.on('click,touchend', function() { 
				$location.path(attrs.href); 
			}); 
		} 
	}, 
	priority: 1 
	}; 
});