I am creating a mobile web application with Angular and I am trying to enable ngTouch (angular - touch) to speed clicks on mobile devices.
Here is an application without ngTouch: http://lukasolson.imtqy.com/n-spade-cards/ng-click/
Here is the application with ngTouch: http://lukasolson.imtqy.com/n-spade-cards/ng-touch/
I am testing iPhone 5 using Safari.
Without the ngTouch module, everything works fine, but there is such an annoying click delay for 300 ms.
However, with the ngTouch module, every time I click on the screen, the web application thinks I tap twice, disrupting the functionality of my application.
Did I turn on the ngTouch module incorrectly? Why are multiple click events triggered?
Source: http://jsfiddle.net/coma/2hWWa/Check it out on your iPhone: http://jsfiddle.net/coma/2hWWa/embedded/result/
angular.module('app').directive('myclick', function() { return function(scope, element, attrs) { element.bind('touchstart click', function(event) { event.preventDefault(); event.stopPropagation(); scope.$apply(attrs['myclick']); }); }; });
Now you can:
<a myclick="aFunction()">click it!</a>
And this will not "duplicate" clicks. Since then, "stopPropagation" will prevent a click from occurring, only touchstart will fire.
Just check this out and let me know if this is helpful.
Btw, If you don't care about scaling, you can avoid the delay by:
http://updates.html5rocks.com/2013/12/300ms-tap-delay-gone-away
I use to add this for "applications".
UPDATE
https://github.com/angular/angular.js/issues/6251
Source: https://habr.com/ru/post/1526399/More articles:Perform a variable-based data flow task? - ssisJava Regex To Uppercase - javaУпорядочить элементы в списке, чтобы аналогичные элементы были наиболее удалены друг от друга - pythonHow to use mblen ()? - cCSS3 - How do I make one element (preferably a div element) move, moving over another element? - htmlC ++ ++ operator overloading - c ++https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1526401/vim-remap-control-commands-to-space-commands&usg=ALkJrhgAtzJ3zCZ_M94HBTtEQXIO8Tj2FAneed a simple way to create a comparator class used for sorting - java.Net Управление памятью приложений - memory-managementКак разбить не-английский текст на составляющие символы в javascript? - javascriptAll Articles