344840 (10) [Avatar] Offline
#1
Jeremy,

When I take the following route:
Find Locations => Rio de Janeiro => Submit => Click Rio de Janeiro

Conditions show in Fahrenheit
Then:
Side Menu => Settings => Metric Celsius => Side Menu => Find a City => Click Rio de Janeiro

Conditions show STILL in Fahrenheit

It looks like Ionic is showing me a cached view.

I've seen you touching the topic 'caching' here and there, but it would be very helpfull if you could explain caching a little more in depth.
Also, what would be a solution for the problem above? Is there a simple command to clear all cache or cached views ?


Thanks,
Fernando.
jeremy.wilken (208) [Avatar] Offline
#2
Caching was a feature added into Ionic after much of the book was written, so it was a condition I didn't have in mind for all of the examples.

In Chapter 7, I talk about the $ionicConfigProvider. You can use this to disable caching by setting it to 0 in your module config() method.

$ionicConfigProvider.views.maxCache(10);


You can also add this attribute to the ionView directive in the template for the weather to disable caching for just a single view.

<ion-view cache-view="false">


http://ionicframework.com/docs/api/provider/$ionicConfigProvider/
http://ionicframework.com/docs/api/directive/ionView/