angularjs:如何向资源对象添加缓存? [英] angularjs: how to add caching to resource object?
本文介绍了angularjs:如何向资源对象添加缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 http 中添加缓存非常简单.(通过传递 cache=true )
To add caching inside http is pretty straight forward. ( by passing cache=true )
http://docs.angularjs.org/api/ng.$http 有缓存选项.
如何在 angularjs 的 $resource 中添加类似的功能?
How do I add similar functionality in $resource in angularjs ?
推荐答案
自 1.1.2 (commit),所有 $httpConfig 选项都直接暴露在 $resource 操作对象中:
Since 1.1.2 (commit), all the $httpConfig options are directly exposed in $resource action objects:
return {
Things: $resource('url/to/:thing', {}, {
list : {
method : 'GET',
cache : true
}
})
};
这篇关于angularjs:如何向资源对象添加缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文