Riron / ionic-img-viewer

Ionic 2+ component providing a Twitter inspired experience to visualize pictures.
MIT License
283 stars 118 forks source link

EXCEPTION: ele.addEventListener is not a function #32

Closed josuper closed 7 years ago

josuper commented 7 years ago

Hi, i have this issue

error_handler.js:47 EXCEPTION: ele.addEventListener is not a function ErrorHandler.handleError @ error_handler.js:47 IonicErrorHandler.handleError @ ionic-error-handler.js:56 next @ application_ref.js:272 schedulerFn @ async.js:82 SafeSubscriber.tryOrUnsub @ Subscriber.js:223 SafeSubscriber.next @ Subscriber.js:172 Subscriber._next @ Subscriber.js:125 Subscriber.next @ Subscriber.js:89 Subject.next @ Subject.js:55 EventEmitter.emit @ async.js:74 NgZone.triggerError @ ng_zone.js:278 onHandleError @ ng_zone.js:257 t.handleError @ polyfills.js:3 e.runTask @ polyfills.js:3 invoke @ polyfills.js:3 error_handler.js:52 ORIGINAL STACKTRACE: ErrorHandler.handleError @ error_handler.js:52 IonicErrorHandler.handleError @ ionic-error-handler.js:56 next @ application_ref.js:272 schedulerFn @ async.js:82 SafeSubscriber.tryOrUnsub @ Subscriber.js:223 SafeSubscriber.next @ Subscriber.js:172 Subscriber._next @ Subscriber.js:125 Subscriber.next @ Subscriber.js:89 Subject.next @ Subject.js:55 EventEmitter.emit @ async.js:74 NgZone.triggerError @ ng_zone.js:278 onHandleError @ ng_zone.js:257 t.handleError @ polyfills.js:3 e.runTask @ polyfills.js:3 invoke @ polyfills.js:3 error_handler.js:53 TypeError: ele.addEventListener is not a function at listenEvent (ui-event-manager.js:196) at new PointerEvents (ui-event-manager.js:48) at UIEventManager.pointerEvents (ui-event-manager.js:163) at ImageViewerGesture.PanGesture.listen (drag-gesture.js:46) at new ImageViewerGesture (image-viewer-gesture.js:27) at image-viewer.component.js:32 at t.invoke (polyfills.js:3) at e.run (polyfills.js:3) at NgZone.runOutsideAngular (ng_zone.js:144) at ImageViewerComponent.ngOnInit (image-viewer.component.js:32)

albertodeago commented 7 years ago

same issue here

Riron commented 7 years ago

Could you please tell me what versions of Ionic / Angular you are running so I can have a better look at the problem? Thanks

albertodeago commented 7 years ago

Yeah sorry, ionic 2.2.1, same angular

Riron commented 7 years ago

I guess you mean Ionic 2.0.1 with Angular 2.2.1 ? I just tried it with a fresh app install and it works well... Have you tried to update you npm packages ? Not sure what it could be. I'll set up an updated Plunkr with the last Ionic version, hoping it will help if you have a problem somewhere.

josuper commented 7 years ago

@Riron i still have the same issu

see bellow my package.json

{ "name": "ionic-hello-world", "author": "Ionic Framework", "homepage": "http://ionicframework.com/", "private": true, "scripts": { "clean": "ionic-app-scripts clean", "build": "ionic-app-scripts build", "ionic:build": "ionic-app-scripts build", "ionic:serve": "ionic-app-scripts serve" }, "dependencies": { "@angular/common": "2.2.1", "@angular/compiler": "2.2.1", "@angular/compiler-cli": "2.2.1", "@angular/core": "2.2.1", "@angular/forms": "2.2.1", "@angular/http": "2.2.1", "@angular/platform-browser": "2.2.1", "@angular/platform-browser-dynamic": "2.2.1", "@angular/platform-server": "2.2.1", "@ionic/storage": "^1.1.7", "@types/whatwg-fetch": "0.0.33", "ionic-angular": "2.0.0-rc.4", "ionic-img-viewer": "^1.2.1", "ionic-native": "2.2.11", "ionicons": "3.0.0", "rxjs": "5.0.0-beta.12", "whatwg-fetch": "^2.0.2", "zone.js": "0.6.26" }, "devDependencies": { "@ionic/app-scripts": "0.0.47", "typescript": "2.0.9" }, "cordovaPlugins": [ "cordova-plugin-whitelist", "cordova-plugin-console", "cordova-plugin-statusbar", "cordova-plugin-device", "cordova-plugin-splashscreen", "ionic-plugin-keyboard" ], "cordovaPlatforms": [], "description": "ISDzudzar2: An Ionic project" }

Riron commented 7 years ago

Oh i see that you are using ionic-angular 2.0.0-rc.4. Support for this version of Ionic comes with ionic-img-viewer v1.1.8.

So either use ionic-img-viewer 1.1.8, or better, upgrade your Ionic to the latest 2.1.0 😄

albertodeago commented 7 years ago

Oh I see, you're right! But being really dumb (it's my first project in ionic) I'am still not able to make it work... now I have no error messages but it simply don't work... I've imported in the appmodule and it's on the @ngmodule imports. Then I've, on a template, a but when I tap it nothing happens, what am I missing?

josuper commented 7 years ago

Thanks Riron, its working perfectly

Riron commented 7 years ago

@josuper cool 👍 @albertodeago your image is broken. You followed the README ? Installation and then Usage ?