javascript - How to enable double tap on an Angular Js application -
I have created an application that double-clicks the user to edit an item. I want to allow the same functionality on mobile devices, which means that the user will double tap to edit the item.
What is the easiest way to implement it? I would not want to use any additional libraries (I've heard about Hammer and Fingerbread, but have not used it before) nor jQuery (in my app I completely forgot Genoa).
Is it using a library, which will be the easiest and easiest?
Edit: Adding code is my controller to edit this item: And this is my template (z) So you can see that I want to fire my function ng -DoubleClick.I want something like NG-double-tab to fire double tap. I'm reading about the hammer and will use it for double tap but I'm not sure how it works ... You can use Here's an example Here is the code for this instruction
/ / Double-click to edit products $ scope.editItem = function (item) {item.editing = true; }; $ scope.doneEditing = function (item) {item.editing = false; $ Http.put ('/ api / users? Id' + $ scope.User.id, $ scope.User); }; $ scope.cancelEditing = function (item) {item.editing = false; }; $ Scope.deleteItem = Function (item) {delete $ scope.User.todos [item.id]; $ Http.put ('/ api / users? Id' + $ scope.User.id, $ scope.User); };
p (ng-dblclick = "editItem (todo)", ng-hide = "todo" edited Todo.editing ", class =" inline-editing-2 ") ({{todo.content}} form (ng-submit =" doneEditing (todo) "todo- = "text", class = "form-control", ng-model = "todo.content") div.btn-block button (class = "btn btn-success mr-1", ng-show = "todo.editing (Ng-click = "editing (Todo)"). FA FA-Check-Circle Button (Class = "BTN BTN-Warning MR-1", ng-click = "cancel (Todo)") Show = "todo.editing", ng-click = "cancel (todo)") SP N. (ng-click = "cancellation (todo)"). Fa.fa-times-circle
ios-dblclick I I can use a tutorial (write it for iOS, but works on other browsers) to handle double click events on a mobile browser. It has no dependencies and like
ng-dblclick works it is available.
& lt; div ios-dblclick = "removephoto ()" & gt; & Lt; / Div & gt;
app.directive ('iosDblclick', function () {const DblClickInterval = 300; // milliseconds var firstClickTime ( Wait) (waiting) (waiting first) (first date (date (new date)) ()) getTime (); wait sendclick = true; settimeout (function () {waitingSecondClick = false;}, DblClickInterval);} and {wait »secondsClClic = false; var time = (new date ()). GetTime (); if (time - firstclick
Comments
Post a Comment