简体   繁体   English

有没有办法在 angular 项目的资产文件夹中编辑 JSON 文件?

[英]Is there a way to edit a JSON file within the asset folder of an angular project?

I have a language folder inside the angular asset folder where I store multiple JSON file for each language that I read during run time.我在 angular 资产文件夹中有一个语言文件夹,我在其中存储了我在运行时读取的每种语言的多个 JSON 文件。 I would like to make provision so the user may see the contents of the JSON file and edit it.我想做出规定,以便用户可以看到 JSON 文件的内容并对其进行编辑。 This must be updated in the server so it reflects to all the other users.这必须在服务器中更新,以便反映给所有其他用户。

I use JAVA for all the backend services.我将 JAVA 用于所有后端服务。

Is there a way to achieve it and could you point me towards it?有没有办法实现它,你能指点我吗?

在此处输入图像描述

You can not edit served frontend files via your frontend.您无法通过前端编辑提供的前端文件。

To realise this you should save the json file in your backend and request them in your frontend.要实现这一点,您应该将 json 文件保存在后端并在前端请求它们。 If you don not want to request the file each time you can cache it or save it in your localStorage of your browser.如果您不想每次都请求文件,您可以将其缓存或保存在浏览器的 localStorage 中。

If you have the file in the backend you will need an api-access point to manipulate and request the file.如果您在后端有文件,您将需要一个 api 访问点来操作和请求文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM