3
I need help, I can not make work the File api, the commands run all successfully, but when I enter my mobile file manager I can not find the file created I’m using ng-Ordova now, but I’ve tested it in 10 different ways, This is my source now.
aux = cordova.file.dataDirectory;
console.log(aux);
$cordovaFile.createFile(aux, "file.txt", true).then(function (success) {
console.log("createFile success");
console.log(success);
$cordovaFile.checkFile(aux, "file.txt").then(function (success) {
console.log("checkFile success");
console.log(success);
$cordovaFile.readAsText(aux, "file.txt").then(function (success) {
console.log("readAsText success");
console.log(success);
}, function (error) {
console.log("readAsText error");
console.log(error);
});
$cordovaFile.writeFile(aux, "file.txt", "teste", true).then(function (success) {
console.log("writeFile success");
console.log(success);
$cordovaFile.readAsText(aux, "file.txt").then(function (success) {
console.log("readAsText success");
console.log(success);
}, function (error) {
console.log("readAsText error");
console.log(error);
});
}, function (error) {
console.log("writeFile error");
console.log(error);
});
}, function (error) {
console.log("checkFile error");
console.log(error);
});
Obs: I’ve tried compiling the project and via phonegap