I get an Error:
{"__zone_symbol_currentTask":{"type":"microTask","state":"notScheduled","source":"Promise.then","zone":"angular","cancelFn":null,"runCount":0}}
And that's the code:
async getNewData(id: number, path: string, howMany: number) {
let fileManagement: FileManagement = new FileManagement();
let result: any = null;
switch (id) {
case 0:
alert("pfad: " + path);
await fileManagement.readFile(path + "Tasks/", "task_" + howMany + ".tsk").then((text) => {
alert("text: " + text);
result = JSON.parse(text);
alert("ganz fertig");
}).catch((error)=>{
alert("nein, error: " + JSON.stringify(error));
});
default:
result = JSON.parse(this.getDataFromComponent(id, howMany, path));
//wenn komponenten aufgerufen werden sollen zum generieren
}
return result;
}
constructor(public navCtrl: NavController, private tts: TextToSpeech, navParams: NavParams) {
this.path = navParams.get('path'); //PFAD DES ÜBUNGSORDNERS HIER ÜBERGEBEN
this.newData.getNewData(0, this.path, this.fileCounter).then((data) => {
this.buffer = data;
this.fileCounter++;
this.nextChoice(0);
}).catch((error) => {
alert(JSON.stringify(error)); //here the error is thrown
});
}
Could you please tell me why that is and how I can fix it? I would appreciate any answer!