ng-swipe
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

This library is an Angular directive wrapper around the vanilla JS swipe detection library ag-swipe-core.

For more details on the public interface of the library please see the Github page.

Installation

npm install ng-swipe --save

Usage

import { SwipeModule } from 'ng-swipe';

@NgModule({
  imports: [
    SwipeModule
  ],
})
import { SwipeEvent } from 'ng-swipe';

@Component({
  selector: 'app',
  template: `
    <div 
      ngSwipe 
      (swipeMove)="onSwipeMove($event)" 
      (swipeEnd)="onSwipeEnd($event)"
    >Swipe me!</div>
  `
})
export class AppComponent {
  onSwipeMove(event: SwipeEvent) {
    console.log(`SwipeMove direction: ${event.direction} and distance: ${event.distance}`);
  }
  onSwipeEnd(event: SwipeEvent) {
    console.log(`SwipeEnd direction: ${event.direction} and distance: ${event.distance}`);
  }
}

/ng-swipe/

    Package Sidebar

    Install

    npm i ng-swipe

    Weekly Downloads

    351

    Version

    2.0.1

    License

    ISC

    Unpacked Size

    24.2 kB

    Total Files

    13

    Last publish

    Collaborators

    • agoncharuks