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

249
Views
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 answers
Answer question

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 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!