pedroabreu / ion-gallery

Ionic gallery directive
MIT License
124 stars 61 forks source link

Gallery Spinner Problem #21

Closed ghost closed 8 years ago

ghost commented 8 years ago

We create multiple Galleries on one Page out of a data-object via ng-repeat.

One Gallery has e.g. 3 Pictures, the next one has 4 pictures and the last one has 8 pictures.

If I click on the first gallery (Thumbnails of any picture) everything is fine, it slides through 3 pictures.

If I click on the second gallery (Thumbnails of the first 3 pictures) i can only slide through the first 3 pictures, then it starts again. 1 -> 2 -> 3 -> 1 (Where is 4?)

If I click on the third gallery (Thumbnails of the first 3 pictures) i can only slide through the first 3 pictures, then it starts again. 1 -> 2 -> 3 -> 1 (Where is 4,5,6,7,8?)

If I click on the second or third gallery (Thumbnails not of the first 3 pictures) i can slide through the whole gallery once 8 -> 7 -> 6 -> 5 -> 4 -> 3 -> 2 -> 1. When I reach the point where the gallery starts again from beginning or end, again there is the 3 picture issue. 8 -> 7 -> 6 -> 5 -> 4 -> 3 -> 2 -> 1 | -> 3 -> 2 -> 1 (Where is 4,5,6,7,8?)

pedroabreu commented 8 years ago

Interesting. Never tried with more than on gallery on the same page, have to test it.

So on your template you have this ?

<div ng-repeat="items in item">
<ion-gallery ion-gallery-items="items"></ion-gallery>
</div>

(This code snippet might be wrong, just typed it from memory)

ghost commented 8 years ago

It is like this:

<div ng-repeat="group in galleryContents" class="group"> <div> <h2 translate-once="GALLERY.GROUP_{{$index +1}}.TITLE"></h2> <h4 translate-once="GALLERY.GROUP_{{$index +1}}.DESCRIPTION"></h4> </div>
<hr /> <ion-gallery ion-gallery-items="group"></ion-gallery> </div>

ghost commented 8 years ago

Do you have an update for me?

Greetings

pedroabreu commented 8 years ago

I've found the issue. It's because the gallery length is set inside a service, which makes it persistent across all instances. I need to pass that to scope to make it independent.

I'll have a fix this weekend, because it might need some refactoring

ghost commented 8 years ago

Hi there,

i just wanted to know how far you are with the fix. I found the problem myself and could fix it, but if you have already done it this would be a waste of time.

Greetings, Adrian

pedroabreu commented 8 years ago

Hey

I started doing the changes but haven't finish them. If you can, open up a PR and I'll have a look and change something if needed.