本文介绍了Angular 2 Material 2 Slide Toggle 在 Alpha 7 中似乎不起作用错误:找不到名称“HammerInput"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚升级到 Alpha 7,升级后滑动切换似乎坏了.
I just upgraded to Alpha 7 and after upgrade Slide Toggle seems to be broken.
当我在 Visual Studio 2015 中编译我的项目时,我收到以下错误:
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
显然,下面这行导致了 slide-toggle.d.ts 中的问题:
Apparently it seems that the below line is causing the problem in slide-toggle.d.ts:
_onDrag(event: HammerInput): void;
推荐答案
感谢大家通过命令安装typings:
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" />
更多详情,请看:
https://github.com/angular/material2/issues/977#issuecomment-238946558
这篇关于Angular 2 Material 2 Slide Toggle 在 Alpha 7 中似乎不起作用错误:找不到名称“HammerInput"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!