Vertical scroll is not working with HammerJS and Angular2

前端 未结 5 488
盖世英雄少女心
盖世英雄少女心 2021-02-02 08:01

I\'m having a problem using the HammerJS with Angular2. I have a carousel (based on the bootstrap carousel with Angular2 event handlers) where I\'m listening to the swip

5条回答
  •  生来不讨喜
    2021-02-02 08:56

    Like a few other answers have mentioned in

    npm install hammerjs --save

    maint.ts

    import 'hammerjs';
    

    app.module

    import { BrowserModule, HammerGestureConfig, HAMMER_GESTURE_CONFIG } 
    from '@angular/platform-browser';
    ...
    export class HammerConfig extends HammerGestureConfig {
      overrides =  {
          'pinch': { enable: false },
          'rotate': { enable: false }
      }
    }
    ...
      providers: [
        {
          provide: HAMMER_GESTURE_CONFIG,
          useClass: HammerConfig
        }],
    ...
    

    I tried a million variations of the configuration and scrolling still did not work when I tested in chrome, I dont know if its the version or what but it did not work. When I tested in an actual mobile phone scrolling was working!

提交回复
热议问题