这个问题在这里已经有了答案:
retain angular variables after page refresh
(5 个回答)
5年前关闭。
每次刷新页面时,AngularJS 变量中的数据都会丢失。如何在不使用 cookie 的情况下保留它们?任何人都可以帮助我提供一种方法吗?它不同于previous question因为我对不使用 cookie 的解决方案感兴趣。
最佳答案
对于小于 4k 的数据量,您可以使用 $cookieStore。
如果不止于此,您将需要查看 HTML5 localStorage
For more details please go through this post you will find different options of storage with comparison http://www.html5rocks.com/en/tutorials/offline/storage/
关于刷新页面时 AngularJS 数据丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35569807/