I saw several different messages saying that I can’t find local files to open them, be it images or data files, but none of the solutions worked for me. I assume there is some kind of configuration that I am missing.
The file I'm looking for is located in a folder named "data" at the same level as the app.html and app.ts files.
Here is what I have in app.html, PS I also use Ionic2:
<ion-menu (click)='getDepartments()' side='right' type='overlay' [content]="content">
and in the app.ts file I have:
getDepartments() { this.http.get('/data/data.json') .map(res => res.json()) .subscribe( data => this.departments = data, err => console.log(err), () => console.log('Random Quote Complete') ); }
I tried:
./data/data.json data/data.json app/data/data.json
and any other way. And they all return 404 error not found. It's like growing pains when getting to know Angular 2. Thanks in advance
source share