Storing file using NgCordova File Plugin

I am looking to create and save a file in application sandbox in a persistent location.
While going through the docs, Found out that “cordova.file.dataDirectory” would probably work for me.

So, In my controller, I am doing something like this:

var filePath = window.cordova.file.dataDirectory + “/sampleFile”;
$cordovaFile.createFile(filePath, true).then(function (result) { /* DO SOMETHING */ });

However when I run this on an android device, the File doesn’t get created in the Files dir of the sandbox. Is there any existing sample for such a case or if someone can point out whats wrong in this code.

Do I need t resolve cordova.file.dataDirectory somehow to Local FileSystem path for this to work. Any existing example would help

@AspPeek Did you solve the problem please ?

Not yet. waiting for someone to help here

Have a look at this answer on it help me with the same issue.

Do you do it on ionicplatform.ready ?

What is an error? (you know you can see console logs when running on device with livereload)

You use createFile(filePath, true) but I think it should be createFile(FolderPath, nameOfYourFile.extension, true)

Take a look to ngCordova documentation
createFile(path, file, replace)