AngularJS:ngTouch 300ms的延迟 [英] AngularJS: ngTouch 300ms Delay

查看:638
本文介绍了AngularJS:ngTouch 300ms的延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这Plunkr有2个链接。在左侧的一个是使用与角式触控模块上插入纳克点击指令。作为在角触控模块介绍说,NG-单击时,NG单击链接不应该有一个300毫秒的延迟。但是,如果你测试它在移动设备上,这仍是如此。

This Plunkr has 2 links. The one on the left side is using the ng-click directive with the on angular-touch module inserted. As said in the angular touch module description for ng-click, the ng-click link should not have a 300ms delay. But if you test it on mobile devices, this is still the case.

那么,plunkr preventing正确的功能,因为它在一个iFrame或执行一些类似的或插入Fastclick.js到项目的指令才能正常工作需要它?我不明白这一点,请帮助。

So is plunkr preventing the correct functionality because its executed in an iFrame or something like that or is it required to insert Fastclick.js into the project for the directive to work correctly ? I don't get it, please help.

例如: http://plnkr.co/NRRrmMFaIKg2zLu5C1Tg

编辑: 的在angularjs文档IST不工作要么。他们甚至没有插入的角度,触控模块。

edit: the example in the angularjs docs ist not working either. They didn't even inserted the angular-touch module.

推荐答案

由于angulars ngTouch模块仅取消对NG-点击指令的300ms的延迟,我使用的 fastclick.js 现在这harmonates具有角完美的罚款。

Because angulars ngTouch module is only removing the 300ms delay on ng-click directives, i'm using fastclick.js now which harmonates perfectly fine with angular.

在开始的时候它没有为我工作,因为我附Fastclick库的脚本加载之前,前DOM准备好了。我在我的角度应用程序的运行段包装功能解决了这个问题。这个函数执行code后DOM准备好了。

At the beginning it did not work for me, because I attached the Fastclick library before its script was loaded, before the DOM was ready. I fixed this by wrapping the function in the run block of my angular app. This function executes code after the DOM is ready.

angular.module('myModule', []).
  run(function() {
    FastClick.attach(document.body);
  });

这方法是通过最新的截屏的YouTube频道。

This way is suggested by the latest screencast on the angularjs youtube channel.

这篇关于AngularJS:ngTouch 300ms的延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆