Hi all.
I have been struggling with this for a very long time and am completely stumped. I am using Ionic 3.
I am trying to load a local JSON file from assets/data/oral/oral-template.json. It works absolutely fine using the Angular Docs guide for Local JSON data on the browser simulator, but when building on device it does not work at all.
I also attempted to use Ionic File to do the same task but the documentation for that was absolutely opaque and didn’t give any of the information I could use to read this local file.
setupQuestionService() {
this.http.get('/assets/data/oral/oral-template.json')
.subscribe(res => {
console.log("HTTP RESPONSE:")
console.log(res)
let data = (res as any).questions
for (let dataIndex=0; dataIndex<data.length; dataIndex++) {
let newQuestion = new OralQuestion(data[dataIndex].module, data[dataIndex].section, data[dataIndex].questionText, data[dataIndex].answerText)
this.questions.push(newQuestion)
}
})
}
Again, this works absolutely fine on the ionic serve -l simulator but when building on my iPhone it doesn’t respond.
Thanks for any help you can give.