本文介绍了Angular 2 Material 2 Slide Toggle似乎无法在Alpha 7中工作错误:找不到名称"HammerInput"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚升级到Alpha 7,升级后,Slide Toggle似乎坏了.
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;
推荐答案
感谢大家通过命令安装键入内容:
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
这篇关于Angular 2 Material 2 Slide Toggle似乎无法在Alpha 7中工作错误:找不到名称"HammerInput"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!