Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with remove() function #405

Closed
jigneshHchauhan opened this issue Sep 30, 2021 · 4 comments · Fixed by #411
Closed

Issue with remove() function #405

jigneshHchauhan opened this issue Sep 30, 2021 · 4 comments · Fixed by #411
Labels

Comments

@jigneshHchauhan
Copy link

What is the expected behavior?

  • Image should be removed from gallery and count should be updated.

What is the current behavior?

  • Image is removed but count is not updated as well as it is showing black screen on place of removed image.

Which versions are you using for the following packages?

Angular: "12"
Angular CDK: "12.0.0"
Angular CLI: "12.0.5"
Typescript: "4.2.3"
Gallery: "5.0.0"

Screenshot (133)_LI
Screenshot (134)_LI

` this.gallery.ref("myGallery").load([
new ImageItem({ src: 'antarctica-iceberg-ocean.jpg', thumb: 'antarctica-iceberg-ocean.jpg' }),
new ImageItem({ src: '1945822.jpg', thumb: '1945822.jpg' }),
new ImageItem({ src: 'forest-mountains-sunset-river.jpg', thumb: 'forest-mountains-sunset-river.jpg' })
]);

this.gallery.ref("myGallery").remove(1);
`

@MurhafSousli
Copy link
Owner

MurhafSousli commented Oct 2, 2021

Good catch! a workaround for now is just to set the the active element again!

remove(gallery: GalleryRef) {
    gallery.remove(2);
    gallery.set(2);
}

Here is a working stackblitz

@jigneshHchauhan
Copy link
Author

The workaround is working fine for all the indexes but if we remove last image than the same problem occur😅

@shreyshahh
Copy link

@jigneshHchauhan In that case, you need to set index of last image - 1

remove(gallery: GalleryRef) {
    gallery.remove(3); // last image index
    gallery.set(2);
}

@MurhafSousli MurhafSousli linked a pull request Nov 6, 2021 that will close this issue
@MurhafSousli
Copy link
Owner

Fixed in v5.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants