Actually I tried to read a file in ionic 2 using a filereader object.
But instead of firing the onloadend function I can see all my wanted
data in the console by adding the whole reader into the output, but I’m
not able to get this data.
Here’s my code:
loadFile(path) {
this.platform.ready().then(() => {
window.resolveLocalFileSystemURL(path, gotFile, fail);
function fail() {
// errorHandling
}
fileEntry.file(function(file) {
var reader = new FileReader();
reader.onloadend = function(evt) {
console.log('onload');
}
reader.readAsText(file);
console.log(reader);
})
}
});
In the console I can see under onloadend inside the caller object under arguments and under caller the following message:
Exception: TypeError: 'caller' and 'arguments' are restricted function properties and cannot be accessed in this context. at Function.remoteFunction (:3:14) at Object.InjectedScript.callFunctionOn (:724:66)
How can I fix this problem? Thanks in advance!