I'm using hammerjs for detecting swipe on a small Angular 8 app.
I followed this article - https://medium.com/angular-in-depth/gestures-in-an-angular-application-dde71804c0d0 - and I'm using hammerjs with @angular/platform-browser.
However, when 3 days ago Angular 9 was released - I updated with no issues, but now swiping detection is not working at all :( ... don't see errors or warnings. Also - didn't see any notes for platform-browser changes in the update release notes.
Any ideas what's wrong and how to fix it?
The most important thing is to import the HammerModule in app module file. In your angular project, install the hammerjs package locally by running the below command. Now, you will need to import the hammerjs module in your main. ts file.
I had the same issue and managed to come across this article which has solved my problem.
hammerjs is now optional
In earlier versions hammerjs was required to add gesture support, it is optional now and all implementation used internally is removed, you can use HammerModule from @angular/platform-browser.
Simply adding the HammerModule
import to my AppModule
fixed it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With