【发布时间】:2015-02-27 02:10:02
【问题描述】:
我有一个简单的 angularjs 应用程序,例如:
module = angular.module 'testFooBarModule', ['ngResource']
module.factory 'FooBar', ($resource)->
$resource 'foobar/target', {},
load:
method: 'GET'
cache: false # no effect
headers:
'Cache-Control': 'no-cache' # no effect
module.controller 'FooBarCtrl', ($scope, FooBar)->
FooBar.load (result)->
console.log result
使用家庭 wlan 或移动 hspa 等高速互联网,一切正常。请求已触发,服务器给了我一个独特的响应。 但是对于像 edge 或 gprs 这样的 2G 互联网,服务器不会收到任何请求,而 angularjs 应用程序总是给我相同的结果。不会发生错误。 “no-cache”标头也被发送。
我不知道出了什么问题。谁能帮帮我?
对不起我的英语:D
最好的问候。
【问题讨论】:
-
到目前为止,我已经看到其他人通过在 GET 请求中添加动态参数(例如时间戳)来模拟新请求来解决这个问题。在这种情况下还没有看到使用无缓存。
-
你也可以使用角度承诺来缓存数据。
标签: angularjs caching web-applications coffeescript