How to preload images and pages on command?

Hi guys,

Awesome work with ionic, congrats on the release of v2. I’ve been following it closely since the beta versions and have now built a fully functional app. I am looking to beta test soon, but before this would like to optimise certain parts of the app. I would preferably like the images of the first page on entry to app to be preloaded prior to entering the app. After which once the user is on the first page. I would like all the remaining three tabs to be rendered in the background, so that they are preloaded once the user navigates away from the first tab.

What is the best way to do this as I can seem to find any documentation on this?

You can cache the images with the following plugin: https://github.com/zyramedia/ionic-image-loader

They should be render but hidden, maybe you can maybe preload the data you need on the other tabs and get it instantly when switching tab.

2 Likes

This is ok for images however there is still a delay where the images outline/component outline appears after which the data actually loads. As I am feeding the data through an async pipe. Is there a way of fading in theses components only once they’re loaded? Am I going to have to rewrite my functions to actually subscribe to the observable and then resolve with a promise?

1 Like

I had to subscribe to my observable and set a boolean. Seems a bit dodgy to me though.