Fastclick.js与AngularJS的集成 [英] Fastclick.js integration with AngularJS

查看:954
本文介绍了Fastclick.js与AngularJS的集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立Cordova应用程式,点击回应时间很慢。

I'm building a Cordova application and click response times are slow.

找到用于Angular的角度触摸插件(虽然设计用于Angular 1.2。 0,看起来像它可能工作与旧版本的Angular,因为它只是一组指令),但一旦尝试它,我没有得到我想要的结果。点击仍然无法点击。

I found the angular-touch plugin for Angular (which, while designed for Angular 1.2.0, looks like it would likely work with older versions of Angular, as it's really just a set of directives) but upon trying it out, I didn't get the results I wanted. Clicks still aren't firing on tap.

根据我的理解, fastclick.js 是当前角度触摸的更稳定的替代方案(因为角度触摸仍在开发中)。但是,我希望我的 ng-click 指令可以利用fastclick。

From what I understand, fastclick.js is a more stable alternative to angular-touch at the moment (as angular-touch is still in development). I, however, want my ng-click directives to take advantage of fastclick.

如何集成fastclick。 js with angular - 我可以只包括文件和init脚本,或者我必须包裹fastclick行为在 ng-click (基本上什么角度触摸与其第一-party code)?

How can I integrate fastclick.js with angular - can I just include the file and init the script, or do I have to wrap fastclick behavior in ng-click (essentially what angular-touch does with its first-party code)?

注意:我的应用程序使用Angular 1.0,因为它是在稳定版本之前构建的。

Note: My app is using Angular 1.0, as it was built before the stable release.

推荐答案

这比我想象的简单;我预计不得不修改一些角度指令,但事实证明,这只是一个插件库。我把它包含在我的角图书馆之前,并在我的phonegap应用程序(在调用新的FastClick 每个fastclick文档)后看到即时结果。

This was simpler than I thought; I anticipated having to modify some angular directives, but it turns out that this is just a drop-in library. I included it before my angular library and saw instant results in my phonegap application (after calling new FastClick per the fastclick documentation).

到目前为止,我找不到这种方法的任何缺点。我认为可能会有一些问题与 document.ready -type设置调用(而不是更多的集成到Angular),但似乎没有任何时间问题或任何东西。

So far, I can't find any downsides to this method. I thought that there might be some issues with the document.ready-type setup call (instead of something more integrated into Angular), but there don't seem to be any timing issues or anything.

值得注意的是任何人绊倒这个问题 - 我只使用tap功能;我相信fastclick公开了一些额外的功能,我不是用于这个项目。

Worth noting for anyone who stumbles onto this question - I'm only using the tap functionality; I believe that fastclick exposes some extra functionality that I'm not using for this project.

这篇关于Fastclick.js与AngularJS的集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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