An Angular module to add directive that emit swipe event as Output
.
npm install @isoden/ngx-swipe
- Import
SwipeModule
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { SwipeModule } from '@isoden/ngx-swipe';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
SwipeModule,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
- Use directive
<div
(ngxSwipeX)="onSwipeX($event)"
(ngxSwipeY)="onSwipeY($event)"
></div>
ngx-swipe uses PointerEvent.
please use polyfill (e.g. PEP) if you need.
Pointer events - caniuse