Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
122
rated 0 times [  123] [ 1]  / answers: 1 / hits: 5717  / 11 Years ago, tue, january 7, 2014, 12:00:00

Right now I'm detecting if the user's browser has touch events and listening for touchend instead of click on certain elements (to get over the 'wait-for-double-click' lag). It works great on a slide-out drawer I'm using.



I want to modify my app so that elements with ng-click=function() will respond on click events for desktop (no touch events available) and respond on touchend for touch devices.



I'd rather not create a new directive for ng-touch or something and instead just modify the ng-click directive. I'm not sure how to modify a built-in Angular directive, though.



Is there a way to do this?



Here's a rough JS fiddle I started, but didn't get too far:



http://jsfiddle.net/MTh8U/


More From » angularjs

 Answers
4

It actually sounds like you're trying to duplicate what Angular has already created for mobile: http://docs.angularjs.org/api/ngTouch. Note that this is just another dependency you'll need to inject.


[#48942] Monday, January 6, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
byronkodyo

Total Points: 552
Total Questions: 87
Total Answers: 104

Location: Burundi
Member since Sat, Aug 21, 2021
3 Years ago
;