Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

266
Views
Error: Uncaught (in promise): Response with status: 404 Not Found for URL when upgrading to Angular-CLI + Angular 4

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

enter image description here

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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"
        ]
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!