Material 2.0.0-beta.3 md slider not drag and drop

I hope this is a silly question.

I just added an md slider to a project I am creating for my employer. (so I have no code to express regret)

I have imported MdSliderModule to the module I am working in. Added a tag to my template where I wanted it. He appeared and looks great, but does not pull. I can click on it to change its value, but I cannot drag it.

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

We use:

  • Angular ^ 4.0.2
  • Material 2.0.0-beta.3

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

+3


source to share


2 answers


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

npm install --save hammerjs

      

then add hammerjs as a dependency in scripts

your file array angular-cli.json

:



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

      

Hopefully this solves the problem - recompile everything to make sure the changes take effect.

+4


source


Only the accepted answer didn't work for me. Finally found a comment in the github questions that solved it. After hammerjs was installed in Step 5 Gesture Support added this to root.module.ts to win:



import { BrowserModule, HAMMER_GESTURE_CONFIG } from '@angular/platform-browser';
import { GestureConfig } from '@angular/material';

providers: [
    { provide: HAMMER_GESTURE_CONFIG, useClass: GestureConfig },
]

      

+1


source







All Articles