1.1.2 • Published 8 years ago

angular-click-x v1.1.2

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

Angular Click X

clickX is an alternative to core ngClick directive provided by ngTouch module.
Simple, configurable & lightweight!

Why?

DEPRECATION NOTICE: Beginning with Angular 1.5, this directive is deprecated and by default disabled. The directive will receive no further support and might be removed from future releases. If you need the directive, you can enable it with the $touchProvider#ngClickOverrideEnabled function. We also recommend that you migrate to FastClick. To learn more about the 300ms delay, this Telerik article gives a good overview.

More info in this commit.

Install

Include the click-x.js / click-x.min.js script provided by this component in your app.

via CDN: https://cdn.rawgit.com/TanaseButcaru/angular-click-x/1.1.2/click-x.min.js
via NPM: npm install angular-click-x
via Bower: bower install angular-click-x

Configuration

Before any configuration, make sure to add tb.clickX to your app’s module dependencies:

angular.module('yourApp', ['tb.clickX']);

Inject the clickXConfigProvider provider in your config block and configure clickX as follows:

  • change default active class name (defaults to click-x-active)
clickXConfigProvider.setActiveClass('myNewClass');
  • adjust swipe detection process
clickXConfigProvider.setSwipeConfig({
  //required min distance traveled to be considered swipe (px)
  threshold: 50,
  //max distance allowed at the same time in perpendicular direction (px)
  restraint: 50,
  //max time allowed to travel that distance (ms)
  allowedTime: 400
});

Usage

as attribute

  <button click-x="doSomethingAwesone()">
  	...
  </button>

Support

Should work fine on all devices.
Tested on:

  • mobile browsers;
  • desktop browsers (Firefox, Chromium, Safari) with & without touch emulation active;
  • a Cordova hybrid mobile app on Android (4.4, 5.x, Crosswalk webview) and iOS (9, Safari UIWebView);

Known issues

  • none.

Demo

Coming soon