Having passed an identifier to the load function, I pull out the file names from the table from which I later generate links and click the links to the photo on click.
<div ng-repeat="img in photo"> <a href="" ng-click="showImg = !showImg;load(img.id)">Show images</a> <span id="list_photo" ng-show="showImg"></span> </div> Function:
$scope.image = function (id) { $http.get('http://site.com/photo/img/'+id) .then(function success(response) { img = response.data; console.log('Ответ: ', response.data); var currentIndex = 0; $("#list_photo").html("<img src='#' />"); $("#list_photo > img").click(function () { if (currentIndex >= img.length) currentIndex = 0; $(this).attr("src", "/public/upload/pict/"+ img[currentIndex++].filename); }); $("#list_photo > img").click(); }); }; The fact is that for some reason only a photo is opened, the link of which is above all, i.e. last one. If I click on the remaining Show images , I see in the console that the file names are returned, but the photo does not open near the link. How can I tie these photos to specific positions of Show images ?
$.ajaxin an angular application. Anguular has its$http. - Stepan Kasyanenko$http. Then stop creating elements usingjQuery. And then the problem will disappear itself) - Stepan Kasyanenko