Reputation: 227
I tried this:
this.item = this.params.get('filename');
console.log("[INFO] Opening File: >" + this.item + "<");
this.textboxContent = this.file.readAsText(this.file.dataDirectory, this.item);
console.log("[INFO] Content of textboxContent: >" + this.textboxContent + "<");
But i get in logcat:
[INFO:CONSOLE(56865)] "[INFO] Content of textboxContent: >[object Promise]<"
this.item is:
[INFO:CONSOLE(56863)] "[INFO] Opening File: >SomeFile.txt<"
Upvotes: 1
Views: 1030
Reputation: 628
This is because readAsText returns a promise. You should do this instead
this.file.readAsText(this.file.dataDirectory, this.item).then((content)=>
{
this.textboxContent = content;
})
Upvotes: 2