compact / angular-bootstrap-lightbox

An AngularJS lightbox built using UI Bootstrap Modal.
http://compact.github.io/angular-bootstrap-lightbox/
MIT License
306 stars 134 forks source link

How opening the current image on other pages in paging? #10

Closed ThiagoJem closed 9 years ago

ThiagoJem commented 9 years ago

Images that are not on the home page (index) will not open . How to configure to display the current image that are on other pages in the paging ?

Thank you!

compact commented 9 years ago

Sorry, I don't understand. Can you show code or screenshots?

ThiagoJem commented 9 years ago

Hi compact, First I want to thank you for providing this excellent tool.

I'll try to explain better (sorry , I understand little English ): I have a pagination in my site(https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination) the images that are on page 2 onwards , when clicked , opens the first image of page 1. I would like to open the corresponding image , how can I do this?

ThiagoJem commented 9 years ago

I posted a vídeo for demonstration, please view...

Link vídeo: http://tinypic.com/m/il9ceg/1

On page 1 the corresponding images to click open normally. On page 2 opens the corresponding images page 1.

compact commented 9 years ago

It looks like you are using $index as in Lightbox.openModal(images, $index), but each page in the pagination starts it over at 0, so $index goes 0, 1, 0, 1, 0, 1... instead of 0, 1, 2, 3, 4, 5...

I found a relevant answer in that library: https://github.com/michaelbromley/angularUtils/issues/76

Add this to your controller:

$scope.imageIndex = $scope.$index + ($scope.currentPage - 1) * $scope.pageSize;

Then change your $index to imageIndex.

ThiagoJem commented 9 years ago

It did not work. I thought better and I will make content open on another page , I will most benefit and ease in other implementations. Valeu, abraço!