2

I don't know why but hammer-js doesn't work at all with my angular 2 project and it doesn't show any mistakes.

This is how I connect it to project

<script src="https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.8/hammer.js"></script>
<script>
TouchEmulator();
</script>

and Then I just put (swiperight)="test()" to my html tag but nothing happen when I try swipe it. Test function has just console.log()

3

1 Answer 1

1

You would have to do

npm install hammerjs

then you would go to your app.module.ts and do:

import 'hammerjs'

This tutorial might guide you further on your quest: https://scotch.io/tutorials/using-hammerjs-touch-gesture-in-angular-2

1
  • Well I fixed it and its work but is it any possible way somehow connect it to HostListener? It would be really cool Commented Aug 31, 2017 at 3:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.