【发布时间】:2015-05-18 16:19:19
【问题描述】:
我正在尝试使用 angular-cache v4.2: angular-cache 我无法在页面刷新之间存储它。
我试图创建一个 codepen,但由于我无法在其中注入模块,所以并没有走得太远。 codepen.
angular.module('myApp', ['angular-cache'])
.config(function (CacheFactoryProvider) {
angular.extend(CacheFactoryProvider.defaults, { maxAge: 15 * 60 * 1000 });
})
但是,即使我让它创建缓存,刷新页面时它也会丢失缓存 - 我尝试了三种不同的存储类型,但无法在 chrome 版本 39 上运行。
【问题讨论】:
-
您可能希望查看
local storage作为数据持久性的一个选项;它也有可用的包装器,比如这个:angular local storage module -
谢谢,这是一种享受!
标签: angularjs caching angular-cache