MurhafSousli / ngx-gallery

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

Different config for Lightbox and Gallery? #327

Closed mrtungdev closed 4 years ago

mrtungdev commented 4 years ago

Hi there, I'm using a gallery with options:

<gallery [id]="galleryId" [items]="photos" [imageSize]="'cover'" [counter]="false"
        (itemClick)="onGalleryClick($event)" [dots]="true" [thumb]="false"></gallery>

When an item clicked, I want to call a lightbox with Thumb = true, imageSize="contains". How can I open a lightbox with a different config?

Which versions are you using for the following packages?

Angular: 9.0 Angular CDK: 9.1 Angular CLI: 9.0 Typescript: Gallery: 5.0.0-beta.0

Is there anything else we should know?

MurhafSousli commented 4 years ago

@ImTung Assume your lightbox gallery id is "lightbox", get the galleryRef e.g. const galleryRef = gallery.ref('lightbox'), then use galleryRef.setConfig(...)

Or with one line: gallery.ref('lightbox', customConfig)

mrtungdev commented 4 years ago

Oh wow, thank you so much @MurhafSousli