Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic framework and angularjs imgcache not working on iOS device

I have built a hybrid app with ionic framework. I have used angular imgcache (https://github.com/jBenes/angular-imgcache.js/tree/master) to allow caching of images fetched from an external site.

I am using code such as:

<img img-cache ic-src="{{src}}"/>

It works a treat in browser (after using 'ionic serve') on command line. I have tested it in ionic view iOS app. I have now take the xcodeproj that it creates and distributed it for testing but the images do not load.

I have even added the cordova whitelist plugin and set metas to allow CORS requests.

Does anybody have any other ideas what the issue could be?

like image 953
jaget Avatar asked May 28 '15 16:05

jaget


1 Answers

First, make sure you set the img cache to manual init ImgCacheProvider.manualInit = true;in your app.config function.

Second step - call ImgCache.$init() anytime after deviceready event (in your case, somewhere in the $ionicPlatform.ready function).

like image 171
drys Avatar answered Sep 28 '22 00:09

drys