简体   繁体   中英

How to add or edit to a client side json file from Angular?

I am working with Angular 8. I have 2 JSON files on the client-side which are basically an array of JSON objects, from where I read and use in my component. I want to add (or edit) an object in those JSON files using angular only(without sending it to backend) and then make sure component is able to use it. Is it possible through angular? Or will I have to use a typescript file and store all information there?

You can not do file operation only using Angular framework. You can use localStorage or in-memory-db to do that.

https://www.npmjs.com/package/angular-in-memory-web-api

Angular doc for in memory db

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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