How to readAsText?


#1

$scope.zapiszDoTXT = function(param){
var data = param
fileDir = cordova.file.externalDataDirectory.replace(cordova.file.externalRootDirectory, ‘’);
var filePath = fileDir+“Morse.txt”;
$cordovaFile.writeFile(filePath, data, true).then(function(result) {
alert(“Zapisano do pliku Morse.txt”);
}, function(err) {
alert(“Zapisywanie nie powiodło się”);
})

}
$scope.wczytajTXT = function(){
fileDir = cordova.file.externalDataDirectory.replace(cordova.file.externalRootDirectory, ‘’);
var filePath = fileDir+“Morse.txt”;
var name = “Morse.txt”;
$cordovaFile.readAsText(fileDir,name )
.then(function (success) {
console.log(“OK”);
}, function (error) {
console.log(“OK2”);
});

}

I have problem with read some txt file, First function save this file. Second Open this file. But second doesnt work. Please help me