Issue
I use angular-material in my project. I am getting this warnings:
Could not find HammerJS. Certain Angular Material components may not work correctly.
The "longpress" event cannot be bound because Hammer.JS is not loaded and no custom loader has been specified.
I know this is a duplicate of this question
In the answer they have mentioned that:
- We have to add
"^2.0.8",
todependencies
in package.json file. - import
'hammerjs/hammer';
in polyfills.ts file.
In my case everything is fine, still I am getting the same warning in browser console.
Solution
There are 2 ways to solve this problem:
Either include the (main) import in your main module's file or
polyfills.ts
:import 'hammerjs';
Or include the script from a CDN into your
index.html
file:<head> <!-- ... --> <script src="https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.8/hammer.min.js"></script> <!-- ... --> </head>
Answered By - Edric
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.