Angular 9 References/ Templates
References

Touch events / Gestures

This is the documentation for Angular 9.
You can switch to the latest version Angular 10.

Angular supports Hammer.JS gestures.

Applications need to include the HammerJS script itself.

npm install hammerjs

Import HammerModule at the root of your application so that Angular can work with HammerJS to detect gesture events.

Define lazy Hammer loader provider:

providers: [
  {
    provide: HAMMER_LOADER,
    useValue: async () => {
      return import('hammerjs/hammer');
    },
  },
...

Or import the library directly to main.ts file:

import 'hammerjs';

After that you will be able to bind gesture events.

Source
<div (swipe)="swipeHandler()">
  Swipe me!
</div>
export class AppComponent {
  swipeHandler() {
    alert('Swipe handled!');
  }
}
Result
Swipe me!
Links & Tutorials