# How to implement swipe in ionic using HammerJs ?

Hello,

[Hammer Js](https://hammerjs.github.io/) is used to add touch gestures to your web app. In Ionic Framework, we can add swipeable gestures bu using Hammer Js

**Setup**

First, install Hammer Js

> npm install –save hammerjs

After Installation generates a class file using CMD

> ionic g class HammerConfig

It will generate a class file called *HammerConfig.ts*

In *HammerConfig.ts Class should have the following definition*

And register MyHammerConfig Class in a*pp.module.ts*

> { provide: HAMMER\_GESTURE\_CONFIG, useClass: MyHammerConfig }

Add this line to the Providers section in *app.module.ts.*

> import {MyHammerConfig} from ‘../HammerConfig’;

And import MyHammerConfig in the import section.

You can find the gestures which Hammer Js provide from [Here](https://github.com/angular/angular/blob/5298b2bda34a8766b28c8425e447f94598b23901/packages/platform-browser/src/dom/events/hammer_gestures.ts#L15).

**For Example**

> <div(pan)=”onPan($event)”></div>

> onPan(event){

> console.log(event);

> }

You can refer to is live [stackblitz](https://stackblitz.com/edit/pan-gesture?embed=1) project

[**pan-gesture - StackBlitz**  
*Starter project for Angular apps that exports to the Angular CLI*stackblitz.com](https://stackblitz.com/edit/pan-gesture?embed=1&file=app/app.component.ts "https://stackblitz.com/edit/pan-gesture?embed=1&file=app/app.component.ts")[](https://stackblitz.com/edit/pan-gesture?embed=1&file=app/app.component.ts)

Thanks :)
