0

I ran the command npm install --save hammerjs and also put import 'hammerjs'; inside my main.ts.

However when I write for instance

var test = document.getElementById('test');
var hammer = new Hammer(test);

I get the following error "Cannot find name 'Hammer'. Did you mean 'hammer'?"

The auto fill provides me with the following options, but not Hammer.

HammerGestureConfig, HammerGesturePlugin, Hammer_Gesture_Config, Hammer_Loader

What am I missing? Did I forget to run a command to install something?

Thanks, Much appreciated.

fourthking
  • 321
  • 1
  • 4
  • 19
  • This might help you https://stackoverflow.com/questions/41322566/angular-could-not-find-hammerjs – hbamithkumara Nov 19 '19 at 21:03
  • Possible duplicate of [Angular - 'Could not find HammerJS'](https://stackoverflow.com/questions/41322566/angular-could-not-find-hammerjs) – enno.void Nov 19 '19 at 21:17
  • I dont believe its a duplicate, I have ""hammerjs": "^2.0.8"," in my package.json already – fourthking Nov 19 '19 at 21:47
  • If you import hammerjs it is ready to go, see [this article](https://blog.angularindepth.com/gestures-in-an-angular-application-dde71804c0d0). – Daniel Habenicht Nov 19 '19 at 21:55
  • As stated in the original question, I included hammerjs in the main.ts and performing "new Hammer()" throws an error "Cannot find name 'Hammer'" – fourthking Nov 20 '19 at 14:22

0 Answers0