I am working on creating a gallery using the @ks89/angular-modal-gallery
library, and the only remaining task is to assign different ids to each image in the gallery. I attempted to use a for loop, but it returned undefined.
https://i.sstatic.net/7TmEN.png
page1.ts
getAllPosts() {
this.authService.getAllPosts().pipe(takeUntil(this.destroy$)).subscribe((res: any) => {
const response = res;
console.log(response);
this.getFullPosts = response.data.post;
this.personSubject.next(res.data.post)
this.userGallery = res.data.post.forEach(imageObj => {
imageObj.galleryImages = imageObj.images.map(image => {
console.log(image.length)
return new Image(
id: //I need to provide a unique id here for each image in the gallery,
{
img: image,
extUrl: image,
title: image,
})
});
});
});
}
Image.ts
export declare class Image {
id: number;
modal: ModalImage;
plain?: PlainImage;
constructor(id: number, modal: ModalImage, plain?: PlainImage);
}