pedroabreu / ion-gallery

Ionic gallery directive
MIT License
124 stars 61 forks source link

JS error when navigating away from a view that uses ion-gallery without clicking on image #28

Closed ggoforth closed 8 years ago

ggoforth commented 8 years ago

The specific error is:

screenshot 2015-12-26 09 37 56

In doing some quick digging through the source (well organized, BTW) I think it might be related to the modal code for the image click handling.

So, if I:

  1. Navigate into a view with ion-gallery and DO NOT click on any images in the gallery, I get the above area.
  2. Navigate into a view with ion-gallery and DO click on some images, then the error does not happen.

I can debug more and put together an example, but I think the issue is with line 452 in ion-gallery.js. When no image is clicked on, _modal is undefined, thus calling remove yields the error.

ggoforth commented 8 years ago
screenshot 2015-12-26 09 45 06

Can confirm, _modal is indeed undefined if you never click on an image. I can submit a pull request tonight, but I think it's just going to include a:

if (!_modal) return to avoid calling remove if no _modal exists.

pedroabreu commented 8 years ago

Fixed with latest update

ggoforth commented 8 years ago

Can confirm, thanks @pedroabreu!