I updated my project and everything was fine in Angular 2 and now 4. I now brought in Angular-CLI 1.0.0 and it will not find the json file for primeNG.
constructor(private http: Http) {}
getFiles() {
return this.http.get('mock_data/data.json')
.toPromise()
.then(res => <TreeNode[]> res.json().data)
.then(data => { return data; });
}
Is throwing the error and I tried adding a ./ copied the path of the folder to double check.
In my index.html file I have <base href="/"> and the directory is under src
Error:
core.es5.js:1084 ERROR Error: Uncaught (in promise): Response with status: 404 Not Found for URL: http://localhost:4200/mock_data/data.json
Try moving mock_data into the assets folder and then update the url with 'assets/mock_data/data.json'.
Suggested edit:
Another way : only add "mock-data" into .angular-cli.json file:
"assets": [
"assets",
"favicon.ico",
"mock-data"
]