ImgCache.js does not work with cordova


#1

I am using ImgCache.js in my Ionic app.

I initialize it in $ionicPlatform.ready(), as the readme says to do. This initializes with no issues.

I use the directive img-cache ic-src in my <img> tag to attempt to load it from cache, otherwise it loads directly from the given url.

The plugin works nicely on my desktop dev environment, but not on a phone. I was getting “device is not defined” and “FileTransfer is not defined” errors which I solved by installing cordova-plugin-device and cordova-plugin-file-transfer.

Now those errors go away and ImgCache.js is at least loading, but instead every time I load an image I get this:

imgcache.js:46 ERROR: Download error source: https://my.sourceurl.com/subdirectory/picture.jpg
imgcache.js:46 ERROR: Download error target: cdvfile://localhost/persistent/imgcache/##########.jpg
imgcache.js:46 ERROR: Download error code: 3

What the heck is a cdvfile?

Does anyone know how to fix this?