Solvedcomponents Slide Toggle Doesn't Seem to be working in Alpha 7 Error: Cannot find name 'HammerInput'
✔️Accepted Answer
For those finding this issue that have a similar configuration to mine:
angular-material: 2.0.0-alpha.7-3
angular-cli: 1.0.0-beta.11-webpack.2
Just doing the following:
$ npm install --save hammerjs @types/hammerjs
Was all that was needed. Since my tsconfig.json file contains this line:
"typeRoots": [ "../node_modules/@types" ]
I did not have to make any changes to main.ts
Other Answers:
Install hammerjs and its typings. With alpha7, angular2 rc5, typescript 2.0 and webpack (through angular-cli) this worked for me:
npm install --save hammerjs @types/hammerjs
And then import 'hammerjs'
in your main component.
Using angular-cli@latest (webpack)
I added hammerjs
npm install --save hammerjs @types/hammerjs
then on the last line of src/polyfills.ts
I added import 'hammerjs';
Seems like you didn't load the HammerJS
library
import 'hammerjs'; // Recommended
or
<!-- Not recommended when using Webpack -->
<script src="./node_modules/hammerjs/hammer.js">
In addition to ctkdev's solution I had to add hammerjs to the "types" section in tsconfig.json
"types": [
"jasmine", "hammerjs"
]
HI,
I just upgraded to Alpha 7 and after upgrade Slide Toggle seems to be broken.
When I compile my project in Visual Studio 2015 I receive the below errors:
Apparently it seems that the below line is causing the problem in slide-toggle.d.ts:
_onDrag(event: HammerInput): void;