I am trying to using hammer js in ionic angular project.
I have imported hammermodule in my component's module:
import { BrowserModule, HammerModule } from '@angular/platform-browser';
//...
@NgModule({
imports: [
BrowserModule,
HammerModule,
//...
]})
And imported hammerjs inside the component as per docs. But no event is triggered.
<div (swipeleft)="onswipe(i)">swipe me</div>
onswipe(x){
console.log(x,'triggered')
}
HammerModule should be imported inside AppModule(not inside child modules).
You can import 'hammerjs' inside the components.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.