Angular 2 Material 2 Slide Toggle Doesn't Seem to be working in Alpha 7 Error: Cannot find name 'HammerInput'

 ̄綄美尐妖づ 提交于 2019-12-13 07:28:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!