Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

273
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda