Id like to prevent the default behaviour of a controller refreshing every single time I visit a page.
I’ve added cache:true, to my routes to see if that would change anything, but it doesnt.
I have a list of things loading, that I really just want to load on start, and never again. How do I do this??
It seems everyone here is searching for how to trigger a controller everytime, I have the exact opposite problem.
I need to NOT trigger it everytime.
there are two caches --> forwardCache and default caching (only backviews --> caches the previously visited pages).
And the caches are holding only a specific number of views (default 10)
Look into:
http://ionicframework.com/docs/api/provider/$ionicConfigProvider/
Yeah and for your problem --> use services to load and store your data and do not do such things in the controller ;).
Like service:
- provide get method
- sends request to your api and loads the items if the items are not already loaded --> stores them in the service
- if items already loaded --> return them without sending the request again
So you can reuse your items through your whole app after you have loaded them once.