材料 2.0.0-beta.3 md-slider 不拖动 [英] Material 2.0.0-beta.3 md-slider not dragging

查看:17
本文介绍了材料 2.0.0-beta.3 md-slider 不拖动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望这是一个愚蠢的问题.

Hopefully, this is a stupid question.

我刚刚为我为雇主构建的项目添加了一个 md-slider.(因此我没有代码表示抱歉)

I just added a md-slider to a project I am building for my employer. (thus I have no code to show sorry)

我将 MdSliderModule 导入到我正在使用的模块中.在我的模板中添加了我想要的标签.它出现了,看起来不错,但不会拖.我可以点击它来改变它的值,但我不能拖动它.

I Imported MdSliderModule into the module I'm working in. Added the tag in my template where I wanted it. It showed up and looks great but won't drag. I can click on it to change its value but I can't drag it.

我错过了什么吗?Angular 是否有我需要导入的该组件使用的拖动模块?有没有其他人看到这个?

Am I missing something? Does Angular have a Dragging module this component uses that I need to import? Has anyone else seen this?

我们正在使用:

  • 角度 ^4.0.2
  • 材料 2.0.0-beta.3

任何对我尝试的帮助或建议都会有所帮助.提前感谢您抽出宝贵时间.

Any help or suggestions of things for me to try will be helpful. Thank you in advance for your time.

推荐答案

我遇到了完全相同的问题,直到我发现我没有安装hammer.js.

I had exactly the same problem until I discovered that I hadn't installed hammer.js.

npm install --save hammerjs

然后在 angular-cli.json 文件的 scripts 数组中添加hammerjs 作为依赖项:

then add hammerjs as a dependency in the scripts array of your angular-cli.json file:

 "scripts": [
    //possibly other scripts here...
    "../node_modules/hammerjs/hammer.min.js"
  ],
 ...

希望这能解决问题 - 重新编译所有内容以确保更改生效

Hopefully this will resolve the issue - recompile everything to be sure that changes take effect

这篇关于材料 2.0.0-beta.3 md-slider 不拖动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆