MurhafSousli / ngx-gallery

Angular Gallery, Carousel and Lightbox
https://ngx-gallery.netlify.app/
MIT License
609 stars 129 forks source link

Gallery Config overwritten in GalleryService `ref` method #592

Closed tvsbrent closed 11 months ago

tvsbrent commented 11 months ago

What is the expected behavior?

When setting config via the GalleryService.ref method, the config be preserved through multiple invocations of the method.

What is the current behavior?

The default config in the service overwrites any previously set values. It looks like this line is the culprit, as it is always pulling in this.config to be overwritten, but it seems like galleryRef.config should be used instead.

https://github.com/MurhafSousli/ngx-gallery/blob/master/projects/ng-gallery/src/lib/services/gallery.service.ts#L31C38-L31C38

What are the steps to reproduce?

https://stackblitz.com/edit/ngx-gallery-x3gk2f?file=src%2Fmain.ts

What is the use-case or motivation for changing an existing behavior?

Currently config values that are not exposed as inputs to the component cannot be set, unless they are set as the default config.

Which versions are you using for the following packages?

Angular: 16.1.5 Angular CDK: 16.1.5 Angular CLI: ? Typescript: ? Gallery: 11.0.0

Is there anything else we should know?

I opened a PR that I think addresses the issue. I linked the library locally and I was seeing the navigation icon I was setting in the component being used.