简体   繁体   English

如何使用angular.js保存数据?

[英]How can I save data using angular.js?

Can I use JSON or it's not possible by means of Angular? 我可以使用JSON还是无法通过Angular使用?

I want to change data and want it to be changed after refreshing. 我想更改数据,并希望在刷新后进行更改。 What should I use? 我应该使用什么?

What you can use is sessionStorage to store data for the same session and when you refresh the page you can pull the data back from session storage and change it. 您可以使用sessionStorage来存储同一会话的数据,并在刷新页面时将数据从会话存储中拉回并进行更改。

You don't really have to use any angular for that. 您实际上不需要为此使用任何角度。

JSON or Angular doesn't save data. JSON或Angular不保存数据。 It can act as a asynchronous bridge to your backend, allowing you to save data using the backend. 它可以充当到后端的异步桥,从而允许您使用后端保存数据。

With 2-way data binding, you can reflect changes in your model to the front-end immediately. 使用2向数据绑定,您可以将模型中的更改立即反映到前端。 You can store the data wherever you want, Mongo, MySQL, or even the browser's localstorage. 您可以将数据存储在任何位置,无论是Mongo,MySQL还是浏览器的本地存储。

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

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