I'm trying to read a json file from within my Angular2 src/app folder
The directory structure is as follows:-
And I'm trying to read the file in app.config.js using the following code:-
public load() {
return new Promise((resolve, reject) => {
this._http.get("config.json")
.map(res => res.json())
.subscribe((data) => {
this.cache['config.json'] = new ConfigData(data.json());
resolve(true);
});
});
}
But everything I try results in the following error:-
zone.js:2224 GET http://localhost:4200/config.json 404 (Not Found)
Where do I need to put the file?
I've tried moving it to the src directory to no avail. I've also tried:-
app/config.json ./app/config.json
I also added an assets folder under app and added it into there but that didn't work either
What do I need to do?
Thanks
