ngx-gallery
ngx-gallery copied to clipboard
gallary show images only when hover or focus on it first time.
i am using ngx-gallery with angular 9.1.
i am fetching images from web services and building url attaching it like below:
this.service.getAllImages('5ef814a570f45211f5b2b508').subscribe((res: any) => {
res.forEach(img => {
this.galleryImages.push({
small: `/api/image/get/${img.imageid}/sm`,
medium: `/api/image/get/${img.imageid}/md`,
big: `/api/image/get/${img.imageid}`
});
});
});
once i move arrow on gallery it shows images otherwise totally blank.
Avoid doing the this.galleryImages.push in favour of:
this.galleryImages = res.map(item => {
return {
small: /api/image/get/${img.imageid}/sm
,
medium: /api/image/get/${img.imageid}/md
,
big: /api/image/get/${img.imageid}
}});
Anywhere you're adding new records, just replace the existing galleryImages.
Avoid doing the this.galleryImages.push in favour of:
this.galleryImages = res.map(item => { return { small:
/api/image/get/${img.imageid}/sm
, medium:/api/image/get/${img.imageid}/md
, big:/api/image/get/${img.imageid}
}});Anywhere you're adding new records, just replace the existing galleryImages.
Thank you!
Avoid doing the this.galleryImages.push in favour of:
this.galleryImages = res.map(item => { return { small:
/api/image/get/${img.imageid}/sm
, medium:/api/image/get/${img.imageid}/md
, big:/api/image/get/${img.imageid}
}});Anywhere you're adding new records, just replace the existing galleryImages.
Thank you
did that fix the problem?