Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

250
Visualizações
How to get inline or embedded JSON file data

Can you please tell me how to get inline or embedded JSON file?

Error:

polyfills.js:3 GET http://localhost:8100/data/questions.json 404 (Not Found)

Folder path:

enter image description here

survey-data.ts

    @Injectable()
    export class SurveyData {

      constructor(public http: Http) {

      }

     getJson(): Observable<any> {
        return this.http.get("data/questions.json") //not working here
          .map(this.extractData)
          .catch(this.handleError);

      }
}

questions.json

{
    "28903218": {
        "type": "group", 
        "prompt": "Cool, thanks! Now tell us about your child's day:", 
        "description": ""
    }, 
}
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Put the data folder in the www folder. The reason it works is because the www folder is like the root of the "server". This is where static content is served from at runtime. Out of verything else in the src folder, only the assets folder is added to the www folder and the .ts files are compiled to a single entry point file and added to the www/build. In your case data does not get transferred. You can check the contents when you build.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda