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

799
Visualizações
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 Respostas
Responde à pergunta

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