1
Use the angular-bootstrap-lightbox, which serves to show magnified images by clicking on they.
I put the images on different pages, using the ng-repeat
and the custom filter| filterBy: ['id']: ''"
, only that only the image of the first object in the list of the Array is enlarged correctly, the others I need to add +1, +2, +3 and successively. The third object in Array only zooms the image correctly if I add ($index+2), Ex:
$scope.Images =
[
{ id="1", url: "/images/img-1.jpg", src: "/images/img-1.jpg"
},
{ id="2", url: "/images/img-2.jpg", src: "/images/img-2.jpg"
},
{ id="3", url: "/images/img-3.jpg", src: "/images/img-3.jpg"
}
];
The object that is the first in the list of Array $scope.images
works normally
<div ng-controller="QuadrinhosCtrl">
<div ng-repeat="image in images | filterBy: ['id']: '1'">
<a ng-click="openLightboxModal($index)" title="Ampliar Imagem">
<img ng-src="{{image.src}}" width="655" height="406" class="img-thumbnail" >
</a>
</div>
</div>
The object that is the second in the list of Array $scope.images
only works if I add +1 to $index
<div ng-controller="QuadrinhosCtrl">
<div ng-repeat="image in images | filterBy: ['id']: '2'">
<a ng-click="openLightboxModal($index+1)" title="Ampliar Imagem">
<img ng-src="{{image.src}}" width="655" height="406" class="img-thumbnail" >
</a>
</div>
</div>
The object that is the third in the list of Array $scope.images
only works if I add +2 to $index
<div ng-controller="QuadrinhosCtrl">
<div ng-repeat="image in images | filterBy: ['id']: '3'">
<a ng-click="openLightboxModal($index+2)" title="Ampliar Imagem">
<img ng-src="{{image.src}}" width="655" height="406" class="img-thumbnail" >
</a>
</div>
</div>
The default call to the directive, which is inserted in the controller:
$scope.openLightboxModal = function (index) {
Lightbox.openModal($scope.images, index);
};
I tried some more ways I did not succeed, how to solve this problem?
The custom filter (https://github.com/a8m/angular-filter) is needed so that I can place objects on different pages. That works just fine. The problem is only in the same ($index), that in order to enlarge the image equivalent to the page I have to add in the ($index+1), ($index+2), ($index+3) and successively for each new object in the array.
– Thiago Jem