Vertical scroll is not working with HammerJS and Angular2

前端 未结 5 697
盖世英雄少女心
盖世英雄少女心 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:48

    After 2 days of research and frustration I've found the only working solution for me:

    import { HammerGestureConfig, HAMMER_GESTURE_CONFIG } from '@angular/platform-browser';
    
    export class CustomHammerConfig extends HammerGestureConfig  {
        overrides = {
            'pinch': { enable: false },
            'rotate': { enable: false }
        }
    }
    
    
    @NgModule({
    // ... declarations, imports,
    providers: [
            // ...
            {
                provide: HAMMER_GESTURE_CONFIG,
                useClass: CustomHammerConfig
            }
        ],
    bootstrap: [ AppComponent ]
    })
    export class AppModule {
    }
    
    
    

    taken from here

提交回复
热议问题