1

I've a simple angularjs application like:

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

With highspeed internet like home wlan or mobile hspa everything works fine. The request has fired and the server gives me a unique response. But with 2G internet like edge or gprs the server receives no requests and the angularjs app give me always the same results. No errors occur. The "no-cache" header were sended as well.

I've no idea what's wrong. Can anyone help me?

Sry for my english :D

best regards.

2
  • So far I've seen others solving this problem by adding a dynamic param (such as timestamp) to GET request, to simulate new request. Haven't seen usage of no-cache in such case. Commented Feb 26, 2015 at 1:52
  • also you can play with angular promises to cache data. Commented Feb 26, 2015 at 1:56

1 Answer 1

2

Thats probably not an angular issue. My guess is the internet-provider is doing some magic http-proxying to safe bandwidth or your underlying OS is trying to cache it for you.

Some options:

  • using HTTPS should prevent provider man-in-the-middles and for mobile apps in any case a good idea!
  • using a clumsy dynamic parameter like a timestamp
  • use POST or PUT as verbs
  • add the 'Cache-Control: no-cache' header in the server-response, which I think the is the most-clean solution
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.