$cacheFactory causing my controller not to load when the app starts..bottom navbar visible just no data(works on web)

Hi guys! I’ve got an interesting issue here and i’m wondering if you all might be able to help me out.

I’ve got an application running that is using a ion-bar and ion-nav-view… in the first nav view i’m using an ng-repeat to run through an array return from an $http request…blah blah.

So here’s the issue! In order to persist the data once it’s been loaded already i implemented a $cacheFactory to store the data after the first time it’s loaded and check whether or not i already have it each time the view loads… ex:

if(fromCache == null){
	$scope.posts = [];

Now i’m certain the logic here is fine because if i click another view in my app…say view 2 the $http request fires and i’m returned the data and the view populates…AND if i then click on view 1 the same thing happens. From which point on the data is cached and i can move between the two views without re-requesting it from the server…I’m stumped as to why when the application first launches i’m being presented with an empty view… I can provide more of the code if you all need it…

Any help would be greatly appreciated :open_mouth: Thanks!

It’s hard to debug since this only happens on my device however i’m 100% sure this happens due to me calling the $cacheFactory objects when the controller first loads… this should be a problem because the $cacheFactories are created in the $rootScope and i’m only putting/getting from them when the controller loads… interesting.

Update: :frowning: After about 2 hours banging my head against the wall I realized that i was created the $cacheFactories inside of $ionicPlatform.ready()…this causes the controllers to crap out and gives the problems I explained above.