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

795
Views
create file json or text in angular

i am trying to create a file .json or .text in angular and put it in path : /assets.

after searching for a while all result is to get data from file:

we can get data from file using this methode:

this.httpClient.get("assets/data.json").subscribe(data =>{
  console.log(data);
})

But how to post and create a new file data.json and put it in assets?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Browsers aren't allowed to simply write to files to the server. If that was possible, the Google homepage would be vandalised 30 times a second.

You need to write a web service (in the programming language of your choice, which could be JavaScript or TypeScript if you arrange to have a server on which you can use Node.js).

You probably want to write the data somewhere other than assets (which sounds like a directory that is part of the built Angular application and not a user data directory) and you probably should be using a database rather than using JSON file (databases are efficient and deal with simultaneous writes easily) — your web service can have another endpoint that reports the contents of the database as JSON.

Once you have a web service, then you can make a POST or PUT request to the URL for it using @angular/common/http as described in the Angular guide.

about 4 years ago · Juan Pablo Isaza 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!