Clickable images in grid ionic


#1

here is my problem, I have a set of images in grid , each row take 3 images, I can click on images and check the name of the image been clicked . I want to change the image once its clicked, how can I achive this with the current ng-src code.

   <div class="row" ng-repeat="obj in list"  ng-if="$index % 3 === 0">
                <a href=""class="col col-33" ng-click="getSelected(list[$index].Name)" ng-if="$index < list.length">
                    <img ng-src="{{list[$index].imgURL}}"width="100%" />
                </a>
                <a href=""class="col col-33" ng-click="getSelected(list[$index +1].Name)" ng-if="$index + 1 < list.length">
                    <img ng-src="{{list[$index +1].imgURL}}"width="100%" />
                </a>
                <a href=""class="col col-33" ng-click="getSelected(list[$index +2].Name)" ng-if="$index + 2 < list.length">
                    <img ng-src="{{list[$index +2].imgURL}}"width="100%" />
                </a>

    </div>
</ion-content>

#2

you do not need ngSrc:

try

<img [src]="list[$index].imgURL">

Now you can change the image url of list[$index].imgURL and it should work


#3

Thank you, i must use directive of ng-src, the code is working fine, i want to change image once i click on pic , i sloved it by initialize ng-src with diffrent array and toggle pic in controller