在 http 中添加缓存非常简单。 (通过传递cache=true)
http://docs.angularjs.org/api/ng.$http https://docs.angularjs.org/api/ng/service/%24http有缓存选项。
如何在 angularjs 的 $resource 中添加类似的功能?
自 1.1.2 (commit https://github.com/angular/angular.js/commit/af89daf4641f57b92be6c1f3635f5a3237f20c71),所有 $httpConfig 选项都直接暴露在 $resource 操作对象中:
return {
Things: $resource('url/to/:thing', {}, {
list : {
method : 'GET',
cache : true
}
})
};
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)