Socket
Socket
Sign inDemoInstall

angular-swipe

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    angular-swipe

Simple vertical/horizontal swipe gesture directives and a swipe service for AngularJS


Version published
Weekly downloads
123
decreased by-34.22%
Maintainers
1
Install size
21.1 kB
Created
Weekly downloads
 

Readme

Source

Simple vertical/horizontal swipe gesture directives and a swipe service for AngularJS

#angular-swipe

Should be used as a replacement for ngTouch and its ngSwipeLeft and ngSwipeRight directives. The problem with ngTouch is that it replaces all default ngClick directives and can screw up how focus event works in input fields which are wrapped with ngClick directive. More on the problem with ngTouch here: https://github.com/angular/angular.js/issues/6432#issuecomment-54636616.

Install

  • This is intended to be used as npm module only and works really well with browserify.
npm install angular-swipe --save-dev
  • Require the angular-swipe module
import swipe from 'angular-swipe'
  • Add dependency to the angular-swipe ng module
angular.module('app', [ swipe.name ]);

Usage

Directives
  • ng-swipe-up
  • ng-swipe-down
  • ng-swipe-left
  • ng-swipe-right
Directive attributes

ng-swipe-disable-mouse "This attribute is useful for text that should still be selectable by the mouse and not trigger the swipe action."

Service
  • swipe

Example

<div class="page" ng-controller="AppController">
    <div class="container" ng-swipe-up="swipe($event)">
      <h1>Swipe me up!</h1>
    </div>
</div>
import { module, bootstrap } from 'angular';
import swipe from 'angular-swipe';
module('app', [ swipe.name ])
    .controller('AppController', $scope => {
      $scope.swipe = $event => console.log($event);
    })

Known issues and workarounds

  • ng-swipe-up and ng-swipe-down uses preventDefault when you start swiping. This prevents clicks from giving focus to input fields. Adding a noPreventDefault class to these elements will not preventDefault when the swipe start on them and thus allow clicks to work.

FAQs

Last updated on 04 Jan 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc