Integrating HammerJS with Angular
HammerJS
It allows you to perform many different gestures, usually used on the mobile screen.
Integration with Angular
Install hammerjs using the CLI:
npm install hammerjs
Add this to your app.module.ts
:
import { HammerModule } from "../../node_modules/@angular/platform-browser";
Also, add HammerModule
in the imports of app.module.ts
.
Usage in the HTML of your Component:
<div (panup)="onSwipeUp()">
More gestures can be found here.
Don’t forget to add the function in your component’s Typescript file!