Pre-render view


I have a tab with a list that contains about 100 items.
The time it takes for the view to render it for the first time is very slow.
However, if I leave the tab and enter it again (cache is on), the tab is visible instantly.
My question is - assuming the app will start on a different tab, is there any way to pre-render that view in save it in the cache for faster loading at the first entrance?

Thank you


Please advise


you need to use a combination of resolve (in stateprovider) and smart view manipulation. You can not pre render the view, with all the angular directives parsed, as many directives are dependent on $scope for that view’s particular controller.

There is a workaround. Show a loader when the view is being rendered and show the data when parsed. This is the only solution currently without using resolve.

If you are using resolve then the code block is first executed and then the view is shown.


Thank you
However, I’m not sure how will resolve help render the view. Resolve will help me get the data I need before the view starts rendering, but it won’t help me render the view unless I’m in the view.

I can show a loader but that won’t save the time I was looking to save.
Additionally, since the device is busy with rendering - any animated loader is stuck. Any solution at least to that?
Thanks again


As far as I know, no solution for that. This is one of the problems with cordova.


In my mind this is one of the key ‘feel’ weaknesses I’ve found in Ionic. It’s hard to believe that there is no decent solution. You can’t just ‘fake’ a visit to each tab somehow during the splash screen? Is there any hack for this? $Templatecache doesn’t seem to help.


this cannot be changed as this is how the web view works. in case of native apps the app is compiled to bytecode but in case of html, css and js, the app is interpreted everytime it is run. these are two different approaches which will never change.

if this is problem, younare better off with native apps. there are sacrifices to be made for cross platform apps.


I don’t really buy that there is no way to at least improve the load time, I’ll keep looking into it.