mchasles
mchasles

Reputation: 1283

Enable tapping: angular 1.2, ngMobile and ng-click?

Using angular 1.2, I included the angular-mobile.js file and add the ngMobile module to my module dependencies list. Directives 'ng-swipe-left' and 'ng-swipe-right' work well but the 'ng-click' doesn't seem faster. It seems that there's still this 300ms delay on ipad...

Is something more required to use this feature?

By the way, what's the difference between the module ngTouch and ngMobile? Swipe directive seems to works including one either.

Thanks!

Upvotes: 3

Views: 8166

Answers (4)

Dev01
Dev01

Reputation: 14129

I'm using the latest angular and ngtouch 1.2.10 and am also using jQuery. I'm still seeing the same issue you are. I added faskclick and it fixed it. Looks like there is at least one issue open on github for this problem so presumably this will be fixed at some point.

// This code should be added outside of and angularjs code.
window.addEventListener('load', function () {
  FastClick.attach(document.body);
}, false);

Upvotes: 0

Armin
Armin

Reputation: 15938

Look at this answer, the solution works also for angular ng-click directive.

Basically you just need to do this in stop method of jquery-ui-draggable:

$('.selector').draggable({
    stop: function(event, ui) {
        // event.toElement is the element that was responsible
        // for triggering this event. The handle, in case of a draggable.
        $( event.toElement ).one('click', function(e){ e.stopImmediatePropagation(); } );
    }
});

Upvotes: 1

Per Quested Aronsson
Per Quested Aronsson

Reputation: 12100

I have the same issue, and I'm not using jQuery. I have resorted to fastclick, and the app feels much more responsive. Yes, ngTouch is the new version of ngMobile, but in its current state it can only be used for swiping, it seems.

Upvotes: 4

mchasles
mchasles

Reputation: 1283

It seems that the issue is known and happen when jQuery is loaded: https://github.com/angular/angular.js/issues/2548

(according 'AngularJS 1.2 And Beyond' talk, ngTouch will be the new name of NgMobile)

Upvotes: 3

Related Questions