uiuniversal / ngu-carousel

Angular Universal carousel
https://ngu-carousel.netlify.app
MIT License
332 stars 105 forks source link

Update how isLast is set when data is updated #330

Closed ralam closed 3 years ago

ralam commented 3 years ago

Check if the current slide should be the last slide when dataStream is updated. This fixes an issue where the dataStream is updated but the carousel slides do not move. In the current state, isLast will incorrectly be set to false. With these changes, isLast will stay false if the carousel is still on the last slide after the data updates.

I've tested these changes on a local application with this patch.

chivesrs commented 3 years ago

@santoshyadavdev The context for this PR is, if we create a carousel that can be paged left and right, and we also allow the user to remove items from the carousel. Consider the case of a carousel containing suggestions that you can accept or reject. You can page left/right which does nothing but move, but accepting and rejecting removes the element from the carousel. We found that if you were on the last page, accepting or rejecting would remove the element from the carousel, but also somehow enable the "next page" button.

This PR aims to fix that issue.

santoshyadavdev commented 3 years ago

Thanks, @ralam will get it to release on Thursday.