问题
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:
Error Build:Cannot find name 'HammerInput'. node_modules\@angular2-material\slide-toggle\slide-toggle.d.ts 67
Error TS2304 Cannot find name 'HammerInput'. TypeScript Virtual Projects node_modules\@angular2-material\slide-toggle\slide-toggle.d.ts 67
Apparently it seems that the below line is causing the problem in slide-toggle.d.ts:
_onDrag(event: HammerInput): void;
回答1:
Thank you everyone installing typings through command:
npm install --save hammerjs @types/hammerjs
and then importing it in main file solved the issue.:
/// <reference path="../typings/globals/hammerjs/index.d.ts" />
For more details, please have a look at:
https://github.com/angular/material2/issues/977#issuecomment-238946558
来源:https://stackoverflow.com/questions/39019371/angular-2-material-2-slide-toggle-doesnt-seem-to-be-working-in-alpha-7-error-c