Fastclick.js integration with AngularJS Fastclick.js integration with AngularJS angularjs angularjs

Fastclick.js integration with AngularJS


From this page: the "Angular way" is to .run the FastClick initializer in your Angular JS file. Make sure to load the fastclick.js module before your Angular code.

HTML:

<script src="js/fastclick.js"></script><script src="js/app.js"></script><script src="js/filters.js"></script><script src="js/controller.js"></script>

in app.js:

app.run(function() {    FastClick.attach(document.body);});


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).

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.

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.