Store & retrieve an image locally permanently through cordovaFile


I’ve tried to look for ways to store an image through cordovaFile API. After loading the ngCordova.js file (before the cordova.js file), and pass the object $cordovaFile to my controller function, I try to do:

$cordovaFile.createDir("test", false).then(function(result) {
 }, function(err) { 

But the application is stuck and no alert message is shown. I’ve tried to change “test” by “cordova.file.dataDirectory” or just by cordova.file.dataDirectory (without the quotes), but neither of them is working.

Anyone has a clue to fix that please?

I’ve used the function createDir as an example, as I don’t know which path to use to save my file through downloadFile (and then I don’t know how to translate that path so I can use it into a template).

Thanks a lot.

i am new to ionic. please share your knowledge to store the image in localstorage

you need to add plugin: cordova plugin add org.apache.cordova.file