pedroabreu / ion-gallery

Ionic gallery directive
MIT License
124 stars 61 forks source link

error with ng-repeat $index #26

Closed fewiki closed 8 years ago

fewiki commented 8 years ago

Hi, excuse me, I have a problem when I use gallery with ng-repeat, like this:

<div class="topic-item" ng-repeat="info in infos track by $index">
    <ion-gallery ion-gallery-items="infos[$index].imgs" ion-gallery-toggle="false"></ion-gallery>
</div>

The array infos is a gallery array, then the slide will repeat many times on one image, I cannot solve it. Can you help me, thanks~ Best regards~

fewiki commented 8 years ago

wait for answer, thanks~

pedroabreu commented 8 years ago

You are creating one gallery for each image, is that what you want ?

Because if you do that, the slider will always have one image.

AllenConquest commented 8 years ago

I have a similar problem (I think). My code looks like this:

        <ion-slide-box>
            <ion-slide ng-repeat="vehicle in vehicleDetail.vehicles">

                <!--============= pictures gallery =============-->
                <ion-gallery ion-gallery-items="vehicle.images"></ion-gallery>

            </ion-slide>
        </ion-slide-box>

Where each vehicle has an array of vehicle.images. So I want to display a gallery on on each slide. However, I get this error:

Error: Attempted to assign to readonly property.
buildGallery@http://81.187.110.64:8100/lib/ion-gallery/dist/ion-gallery.js:124:19

How can I solve this problem? Thanks for any help.

pedroabreu commented 8 years ago

@AllenConquest sorry for the late reply, do you still have that issue ? I will try to follow your implementation to see if I get that error (Never thought of the idea of loading the gallery inside a slide box, a bit inception-like)