I am currently facing a challenge that I need help with:
https://i.sstatic.net/ytLoj.gif
The issue I am encountering is that when the page loads, the view renders before the images fully load. Is there a way to ensure that the view only renders once the images have completely loaded? It's worth mentioning that the images are hosted on a different domain, specifically on Contentful.
I've been exploring the Resolve API as a solution, but I'm struggling with implementing it since I'm not making an HTTP request.
Below is my attempt at creating a resolve service:
export class GalleryImagesResolverService implements Resolve<any> {
constructor(
private contentfulService: ContentfulService
) { }
resolve(route: ActivatedRouteSnapshot) {
return this.contentfulService.getGalleryImages();
}
}
Here's the contentful service code snippet:
//get Gallery Images
getGalleryImages(query?: object): Promise<Entry<any>[]> {
return this.cdaClient.getEntries(Object.assign({
// include : 2,
content_type: CONFIG.contentTypeIds.gallery
}, query))
.then(res => res.items);
}
Any advice or suggestions would be greatly appreciated! If you have a better approach in mind, please share your insights. :)